]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/preferences_widgets.hpp
Preferences
[vlc] / modules / gui / qt4 / components / preferences_widgets.hpp
1 /*****************************************************************************
2  * preferences_widgets.hpp : Widgets for preferences panels
3  ****************************************************************************
4  * Copyright (C) 2000-2005 the VideoLAN team
5  * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #ifndef _INFOPANELS_H_
25 #define _INFOPANELS_H_
26 #include <vlc/vlc.h>
27 #include <QWidget>
28 #include "ui/input_stats.h"
29
30 class QSpinBox;
31 class QLineEdit;
32 class QString;
33 class QComboBox;
34 class QCheckBox;
35
36 class ConfigControl : public QWidget
37 {
38     Q_OBJECT;
39 public:
40     ConfigControl( vlc_object_t *, module_config_t *, QWidget * );
41     virtual ~ConfigControl();
42     QString getName() { return _name; }
43     bool isAdvanced() { return _advanced; }
44
45     static ConfigControl * createControl( vlc_object_t*,
46                                          module_config_t*,QWidget* );
47 protected:
48     vlc_object_t *p_this;
49     QString _name;
50     bool _advanced;
51 signals:
52     void Updated();
53 };
54
55 /*******************************************************
56  * Integer-based controls
57  *******************************************************/
58 class VIntConfigControl : public ConfigControl
59 {
60 public:
61     VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
62             ConfigControl(a,b,c) {};
63     virtual ~VIntConfigControl() {};
64     virtual int getValue() = 0;
65 };
66
67 #if 0
68 class IntegerConfigControl : public VIntConfigControl
69 {
70 public:
71     IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
72     virtual ~IntegerConfigControl();
73     virtual int getValue();
74 private:
75     QSpinBox *spin;
76 };
77
78 class BoolConfigControl : public VIntConfigControl
79 {
80 public:
81     IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
82     virtual ~IntConfigControl();
83     virtual int getValue();
84 private:
85     wxCheckBox *checkbox;
86 };
87 #endif
88
89 /*******************************************************
90  * Float-based controls
91  *******************************************************/
92 class VFloatConfigControl : public ConfigControl
93 {
94 public:
95     VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
96                 ConfigControl(a,b,c) {};
97     virtual ~VFloatConfigControl() {};
98     virtual float getValue() = 0;
99 };
100
101 #if 0
102 class FloatConfigControl : public VFloatConfigControl
103 {
104 public:
105     FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
106                 ConfigControl(a,b,c) {};
107     virtual ~FloatConfigControl() {};
108     virtual float getValue();
109 private:
110     QDoubleSpinBox *spin;
111 };
112 #endif
113
114 /*******************************************************
115  * String-based controls
116  *******************************************************/
117 class VStringConfigControl : public ConfigControl
118 {
119 public:
120     VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) : 
121                 ConfigControl(a,b,c) {};
122     virtual ~VStringConfigControl() {};
123     virtual QString getValue() = 0;
124 };
125
126 class StringConfigControl : public VStringConfigControl
127 {
128 public:
129     StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
130                          bool pwd );
131     virtual ~StringConfigControl();
132     virtual QString getValue();
133 private:
134     QLineEdit *text;
135 };
136
137 class ModuleConfigControl : public VStringConfigControl
138 {
139 public:
140     ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
141                          bycat );
142     virtual ~ModuleConfigControl();
143     virtual QString getValue();
144 private:
145     QComboBox *combo;
146 };
147 #if 0
148 struct ModuleCheckBox {
149     QCheckBox *checkbox;
150     QString module;
151 };
152
153 class ModuleListConfigControl : public ConfigControl
154 {
155 public:
156     StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
157                          bycat );
158     virtual ~StringConfigControl();
159     virtual QString getValue();
160 private:
161     std::vector<ModuleCheckBox> checkboxes;
162     QLineEdit *text;
163 private slot:
164     void OnUpdate();
165 };
166 #endif
167
168 #endif