1 /*****************************************************************************
2 * preferences_widgets.hpp : Widgets for preferences panels
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Antoine Cellerier <dionoea@videolan.org>
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.
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.
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 *****************************************************************************/
25 #ifndef _INFOPANELS_H_
26 #define _INFOPANELS_H_
32 #include "ui/input_stats.h"
41 class ConfigControl : public QObject
45 ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
46 QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
48 widget = new QWidget( p );
50 ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
51 p_this (_p_this ), p_item( _p_conf )
55 virtual ~ConfigControl() {};
56 QString getName() { return qfu( p_item->psz_name ); }
57 QWidget *getWidget() { assert( widget ); return widget; }
58 bool isAdvanced() { return p_item->b_advanced; }
59 virtual void hide() { getWidget()->hide(); };
60 virtual void show() { getWidget()->show(); };
62 static ConfigControl * createControl( vlc_object_t*,
63 module_config_t*,QWidget* );
64 static ConfigControl * createControl( vlc_object_t*,
65 module_config_t*,QWidget*,
69 module_config_t *p_item;
77 /*******************************************************
78 * Integer-based controls
79 *******************************************************/
80 class VIntConfigControl : public ConfigControl
83 VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
84 ConfigControl(a,b,c) {};
85 VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
86 ConfigControl(a,b) {};
87 virtual ~VIntConfigControl() {};
88 virtual int getValue() = 0;
91 class IntegerConfigControl : public VIntConfigControl
94 IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget *,
96 IntegerConfigControl( vlc_object_t *, module_config_t *,
98 virtual ~IntegerConfigControl() {};
99 virtual int getValue();
100 virtual void show() { spin->show(); label->show(); }
101 virtual void hide() { spin->hide(); label->hide(); }
108 class IntegerListConfigControl : public VIntConfigControl
111 IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
112 bool, QGridLayout*, int );
113 IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
115 virtual ~IntegerListConfigControl() {};
116 virtual int getValue();
117 virtual void hide() { combo->hide(); label->hide(); }
118 virtual void show() { combo->show(); label->show(); }
126 class BoolConfigControl : public VIntConfigControl
129 IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
130 virtual ~IntConfigControl();
131 virtual int getValue();
133 wxCheckBox *checkbox;
137 /*******************************************************
138 * Float-based controls
139 *******************************************************/
140 class VFloatConfigControl : public ConfigControl
143 VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
144 ConfigControl(a,b,c) {};
145 VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
146 ConfigControl(a,b) {};
147 virtual ~VFloatConfigControl() {};
148 virtual float getValue() = 0;
152 class FloatConfigControl : public VFloatConfigControl
155 FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
156 ConfigControl(a,b,c) {};
157 virtual ~FloatConfigControl() {};
158 virtual float getValue();
160 QDoubleSpinBox *spin;
164 /*******************************************************
165 * String-based controls
166 *******************************************************/
167 class VStringConfigControl : public ConfigControl
170 VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
171 ConfigControl(a,b,c) {};
172 VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
173 ConfigControl(a,b) {};
174 virtual ~VStringConfigControl() {};
175 virtual QString getValue() = 0;
178 class StringConfigControl : public VStringConfigControl
181 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
182 QGridLayout *, int, bool pwd );
183 StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
184 QLineEdit*, bool pwd );
185 virtual ~StringConfigControl() {};
186 virtual QString getValue() { return text->text(); };
187 virtual void show() { text->show(); label->show(); }
188 virtual void hide() { text->hide(); label->hide(); }
195 class ModuleConfigControl : public VStringConfigControl
198 ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool,
200 ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
202 virtual ~ModuleConfigControl() {};
203 virtual QString getValue();
204 virtual void hide() { combo->hide(); label->hide(); }
205 virtual void show() { combo->show(); label->show(); }
212 class StringListConfigControl : public VStringConfigControl
215 StringListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
216 bool, QGridLayout*, int );
217 StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
219 virtual ~StringListConfigControl() {};
220 virtual QString getValue();
221 virtual void hide() { combo->hide(); label->hide(); }
222 virtual void show() { combo->show(); label->show(); }
229 struct ModuleCheckBox {
234 class ModuleListConfigControl : public ConfigControl
237 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
239 virtual ~StringConfigControl();
240 virtual QString getValue();
242 std::vector<ModuleCheckBox> checkboxes;