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_
29 #include "ui/input_stats.h"
38 class ConfigControl : public QObject
42 ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
43 QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
45 widget = new QWidget( p );
47 ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
48 p_this (_p_this ), p_item( _p_conf )
52 virtual ~ConfigControl() {};
53 QString getName() { return qfu( p_item->psz_name ); }
54 QWidget *getWidget() { assert( widget ); return widget; }
55 bool isAdvanced() { return p_item->b_advanced; }
57 static ConfigControl * createControl( vlc_object_t*,
58 module_config_t*,QWidget* );
61 module_config_t *p_item;
69 /*******************************************************
70 * Integer-based controls
71 *******************************************************/
72 class VIntConfigControl : public ConfigControl
75 VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
76 ConfigControl(a,b,c) {};
77 VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
78 ConfigControl(a,b) {};
79 virtual ~VIntConfigControl() {};
80 virtual int getValue() = 0;
83 class IntegerConfigControl : public VIntConfigControl
86 IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
87 IntegerConfigControl( vlc_object_t *, module_config_t *,
89 virtual ~IntegerConfigControl() {};
90 virtual int getValue();
93 void finish( QLabel * );
97 class BoolConfigControl : public VIntConfigControl
100 IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
101 virtual ~IntConfigControl();
102 virtual int getValue();
104 wxCheckBox *checkbox;
108 /*******************************************************
109 * Float-based controls
110 *******************************************************/
111 class VFloatConfigControl : public ConfigControl
114 VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
115 ConfigControl(a,b,c) {};
116 VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
117 ConfigControl(a,b) {};
118 virtual ~VFloatConfigControl() {};
119 virtual float getValue() = 0;
123 class FloatConfigControl : public VFloatConfigControl
126 FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
127 ConfigControl(a,b,c) {};
128 virtual ~FloatConfigControl() {};
129 virtual float getValue();
131 QDoubleSpinBox *spin;
135 /*******************************************************
136 * String-based controls
137 *******************************************************/
138 class VStringConfigControl : public ConfigControl
141 VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
142 ConfigControl(a,b,c) {};
143 VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
144 ConfigControl(a,b) {};
145 virtual ~VStringConfigControl() {};
146 virtual QString getValue() = 0;
149 class StringConfigControl : public VStringConfigControl
152 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
154 StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
155 QLineEdit*, bool pwd );
156 virtual ~StringConfigControl() {};
157 virtual QString getValue() { return text->text(); };
159 void finish( QLabel * );
163 class ModuleConfigControl : public VStringConfigControl
166 ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
168 ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
170 virtual ~ModuleConfigControl() {};
171 virtual QString getValue();
173 void finish( QLabel *, bool );
177 struct ModuleCheckBox {
182 class ModuleListConfigControl : public ConfigControl
185 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
187 virtual ~StringConfigControl();
188 virtual QString getValue();
190 std::vector<ModuleCheckBox> checkboxes;