]> git.sesse.net Git - vlc/blob - modules/gui/qt4/components/preferences_widgets.hpp
Fix play/pause icons
[vlc] / modules / gui / qt4 / components / preferences_widgets.hpp
1 /*****************************************************************************
2  * preferences_widgets.hpp : Widgets for preferences panels
3  ****************************************************************************
4  * Copyright (C) 2006 the VideoLAN team
5  * $Id$
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 <QLineEdit>
29 #include "ui/input_stats.h"
30 #include "qt4.hpp"
31 #include <assert.h>
32
33 class QSpinBox;
34 class QString;
35 class QComboBox;
36 class QCheckBox;
37
38 class ConfigControl : public QObject
39 {
40     Q_OBJECT;
41 public:
42     ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
43                    QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
44     {
45         widget = new QWidget( p );
46     }
47     ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
48                             p_this (_p_this ), p_item( _p_conf )
49     {
50         widget = NULL;
51     }
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; }
56
57     static ConfigControl * createControl( vlc_object_t*,
58                                           module_config_t*,QWidget* );
59 protected:
60     vlc_object_t *p_this;
61     module_config_t *p_item;
62     QString _name;
63     QWidget *widget;
64     bool _advanced;
65 signals:
66     void Updated();
67 };
68
69 /*******************************************************
70  * Integer-based controls
71  *******************************************************/
72 class VIntConfigControl : public ConfigControl
73 {
74 public:
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;
81 };
82
83 class IntegerConfigControl : public VIntConfigControl
84 {
85 public:
86     IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
87     IntegerConfigControl( vlc_object_t *, module_config_t *,
88                           QLabel*, QSpinBox* );
89     virtual ~IntegerConfigControl() {};
90     virtual int getValue();
91 private:
92     QSpinBox *spin;
93     void finish( QLabel * );
94 };
95
96 #if 0
97 class BoolConfigControl : public VIntConfigControl
98 {
99 public:
100     IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
101     virtual ~IntConfigControl();
102     virtual int getValue();
103 private:
104     wxCheckBox *checkbox;
105 };
106 #endif
107
108 /*******************************************************
109  * Float-based controls
110  *******************************************************/
111 class VFloatConfigControl : public ConfigControl
112 {
113 public:
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;
120 };
121
122 #if 0
123 class FloatConfigControl : public VFloatConfigControl
124 {
125 public:
126     FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
127                 ConfigControl(a,b,c) {};
128     virtual ~FloatConfigControl() {};
129     virtual float getValue();
130 private:
131     QDoubleSpinBox *spin;
132 };
133 #endif
134
135 /*******************************************************
136  * String-based controls
137  *******************************************************/
138 class VStringConfigControl : public ConfigControl
139 {
140 public:
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;
147 };
148
149 class StringConfigControl : public VStringConfigControl
150 {
151 public:
152     StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
153                          bool pwd );
154     StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
155                          QLineEdit*,  bool pwd );
156     virtual ~StringConfigControl() {};
157     virtual QString getValue() { return text->text(); };
158 private:
159     void finish( QLabel * );
160     QLineEdit *text;
161 };
162
163 class ModuleConfigControl : public VStringConfigControl
164 {
165 public:
166     ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
167                          bycat );
168     ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
169                          QComboBox*, bool );
170     virtual ~ModuleConfigControl() {};
171     virtual QString getValue();
172 private:
173     void finish( QLabel *, bool );
174     QComboBox *combo;
175 };
176 #if 0
177 struct ModuleCheckBox {
178     QCheckBox *checkbox;
179     QString module;
180 };
181
182 class ModuleListConfigControl : public ConfigControl
183 {
184 public:
185     StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
186                          bycat );
187     virtual ~StringConfigControl();
188     virtual QString getValue();
189 private:
190     std::vector<ModuleCheckBox> checkboxes;
191     QLineEdit *text;
192 private slot:
193     void OnUpdate();
194 };
195 #endif
196
197 #endif