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>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef _INFOPANELS_H_
25 #define _INFOPANELS_H_
31 #include "ui/input_stats.h"
40 class ConfigControl : public QObject
44 ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
45 QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
47 widget = new QWidget( p );
49 ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
50 p_this (_p_this ), p_item( _p_conf )
54 virtual ~ConfigControl() {};
55 QString getName() { return qfu( p_item->psz_name ); }
56 QWidget *getWidget() { assert( widget ); return widget; }
57 bool isAdvanced() { return p_item->b_advanced; }
58 virtual void hide() { getWidget()->hide(); };
59 virtual void show() { getWidget()->show(); };
61 static ConfigControl * createControl( vlc_object_t*,
62 module_config_t*,QWidget* );
63 static ConfigControl * createControl( vlc_object_t*,
64 module_config_t*,QWidget*,
68 module_config_t *p_item;
76 /*******************************************************
77 * Integer-based controls
78 *******************************************************/
79 class VIntConfigControl : public ConfigControl
82 VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
83 ConfigControl(a,b,c) {};
84 VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
85 ConfigControl(a,b) {};
86 virtual ~VIntConfigControl() {};
87 virtual int getValue() = 0;
90 class IntegerConfigControl : public VIntConfigControl
93 IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget *,
95 IntegerConfigControl( vlc_object_t *, module_config_t *,
97 virtual ~IntegerConfigControl() {};
98 virtual int getValue();
99 virtual void show() { spin->show(); label->show(); }
100 virtual void hide() { spin->hide(); label->hide(); }
108 class BoolConfigControl : public VIntConfigControl
111 IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
112 virtual ~IntConfigControl();
113 virtual int getValue();
115 wxCheckBox *checkbox;
119 /*******************************************************
120 * Float-based controls
121 *******************************************************/
122 class VFloatConfigControl : public ConfigControl
125 VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
126 ConfigControl(a,b,c) {};
127 VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
128 ConfigControl(a,b) {};
129 virtual ~VFloatConfigControl() {};
130 virtual float getValue() = 0;
134 class FloatConfigControl : public VFloatConfigControl
137 FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
138 ConfigControl(a,b,c) {};
139 virtual ~FloatConfigControl() {};
140 virtual float getValue();
142 QDoubleSpinBox *spin;
146 /*******************************************************
147 * String-based controls
148 *******************************************************/
149 class VStringConfigControl : public ConfigControl
152 VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
153 ConfigControl(a,b,c) {};
154 VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
155 ConfigControl(a,b) {};
156 virtual ~VStringConfigControl() {};
157 virtual QString getValue() = 0;
160 class StringConfigControl : public VStringConfigControl
163 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
164 QGridLayout *, int, bool pwd );
165 StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
166 QLineEdit*, bool pwd );
167 virtual ~StringConfigControl() {};
168 virtual QString getValue() { return text->text(); };
169 virtual void show() { text->show(); label->show(); }
170 virtual void hide() { text->hide(); label->hide(); }
177 class ModuleConfigControl : public VStringConfigControl
180 ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool,
182 ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
184 virtual ~ModuleConfigControl() {};
185 virtual QString getValue();
186 virtual void hide() { combo->hide(); label->hide(); }
187 virtual void show() { combo->show(); label->show(); }
194 struct ModuleCheckBox {
199 class ModuleListConfigControl : public ConfigControl
202 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
204 virtual ~StringConfigControl();
205 virtual QString getValue();
207 std::vector<ModuleCheckBox> checkboxes;