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 virtual ~VIntConfigControl() {};
78 virtual int getValue() = 0;
82 class IntegerConfigControl : public VIntConfigControl
85 IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
86 virtual ~IntegerConfigControl();
87 virtual int getValue();
92 class BoolConfigControl : public VIntConfigControl
95 IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
96 virtual ~IntConfigControl();
97 virtual int getValue();
103 /*******************************************************
104 * Float-based controls
105 *******************************************************/
106 class VFloatConfigControl : public ConfigControl
109 VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
110 ConfigControl(a,b,c) {};
111 virtual ~VFloatConfigControl() {};
112 virtual float getValue() = 0;
116 class FloatConfigControl : public VFloatConfigControl
119 FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
120 ConfigControl(a,b,c) {};
121 virtual ~FloatConfigControl() {};
122 virtual float getValue();
124 QDoubleSpinBox *spin;
128 /*******************************************************
129 * String-based controls
130 *******************************************************/
131 class VStringConfigControl : public ConfigControl
134 VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
135 ConfigControl(a,b,c) {};
136 VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
137 ConfigControl(a,b) {};
138 virtual ~VStringConfigControl() {};
139 virtual QString getValue() = 0;
142 class StringConfigControl : public VStringConfigControl
145 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
147 StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
148 QLineEdit*, bool pwd );
149 virtual ~StringConfigControl() {};
150 virtual QString getValue() { return text->text(); };
152 void finish( QLabel * );
156 class ModuleConfigControl : public VStringConfigControl
159 ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
161 ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
163 virtual ~ModuleConfigControl();
164 virtual QString getValue();
166 void finish( QLabel *, bool );
170 struct ModuleCheckBox {
175 class ModuleListConfigControl : public ConfigControl
178 StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
180 virtual ~StringConfigControl();
181 virtual QString getValue();
183 std::vector<ModuleCheckBox> checkboxes;