]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/preferences_widgets.hpp
Skeleton for modules list widgets in the prefs. I'm not working on it atm so i figure...
[vlc] / modules / gui / qt4 / components / preferences_widgets.hpp
index 7731ea1d32d4f44123aa276238560e9f616b091b..52a0b5586e6ab656d0c0fe99960d557136f2c77f 100644 (file)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
+ *          Antoine Cellerier <dionoea@videolan.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <vlc/vlc.h>
 #include <QWidget>
 #include <QLineEdit>
+#include <QSpinBox>
+#include <QDoubleSpinBox>
+#include <QComboBox>
+#include <QCheckBox>
+#include <QVector>
 #include "ui/input_stats.h"
 #include "qt4.hpp"
 #include <assert.h>
 
-class QSpinBox;
-class QString;
-class QComboBox;
-class QCheckBox;
-
 class ConfigControl : public QObject
 {
     Q_OBJECT;
@@ -50,12 +51,19 @@ public:
         widget = NULL;
     }
     virtual ~ConfigControl() {};
-    QString getName() { return qfu( p_item->psz_name ); }
+    virtual int getType() = 0;
+    char * getName() { return  p_item->psz_name; }
     QWidget *getWidget() { assert( widget ); return widget; }
     bool isAdvanced() { return p_item->b_advanced; }
+    virtual void hide() { getWidget()->hide(); };
+    virtual void show() { getWidget()->show(); };
 
     static ConfigControl * createControl( vlc_object_t*,
                                           module_config_t*,QWidget* );
+    static ConfigControl * createControl( vlc_object_t*,
+                                          module_config_t*,QWidget*,
+                                          QGridLayout *, int& );
+    void doApply( intf_thread_t *);
 protected:
     vlc_object_t *p_this;
     module_config_t *p_item;
@@ -78,32 +86,72 @@ public:
                 ConfigControl(a,b) {};
     virtual ~VIntConfigControl() {};
     virtual int getValue() = 0;
+    virtual int getType() { return 1; }
 };
 
 class IntegerConfigControl : public VIntConfigControl
 {
 public:
-    IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
+    IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                          QGridLayout *, int& );
     IntegerConfigControl( vlc_object_t *, module_config_t *,
                           QLabel*, QSpinBox* );
     virtual ~IntegerConfigControl() {};
     virtual int getValue();
-private:
+    virtual void show() { spin->show(); label->show(); }
+    virtual void hide() { spin->hide(); label->hide(); }
+
+protected:
     QSpinBox *spin;
-    void finish( QLabel * );
+
+private:
+    QLabel *label;
+    void finish();
+};
+
+class IntegerRangeConfigControl : public IntegerConfigControl
+{
+public:
+    IntegerRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                               QGridLayout *, int& );
+    IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
+                               QLabel*, QSpinBox* );
+private:
+    void finish();
+};
+
+class IntegerListConfigControl : public VIntConfigControl
+{
+public:
+    IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                              bool, QGridLayout*, int& );
+    IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+                              QComboBox*, bool );
+    virtual ~IntegerListConfigControl() {};
+    virtual int getValue();
+    virtual void hide() { combo->hide(); label->hide(); }
+    virtual void show() { combo->show(); label->show(); }
+private:
+    void finish( bool );
+    QLabel *label;
+    QComboBox *combo;
 };
 
-#if 0
 class BoolConfigControl : public VIntConfigControl
 {
 public:
-    IntConfigControl( vlc_object_t *, module_config_t *, QWidget * );
-    virtual ~IntConfigControl();
+    BoolConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                       QGridLayout *, int& );
+    BoolConfigControl( vlc_object_t *, module_config_t *,
+                       QLabel *, QCheckBox*, bool );
+    virtual ~BoolConfigControl() {};
     virtual int getValue();
+    virtual void show() { checkbox->show(); }
+    virtual void hide() { checkbox->hide(); }
 private:
-    wxCheckBox *checkbox;
+    QCheckBox *checkbox;
+    void finish();
 };
-#endif
 
 /*******************************************************
  * Float-based controls
@@ -117,20 +165,39 @@ public:
                 ConfigControl(a,b) {};
     virtual ~VFloatConfigControl() {};
     virtual float getValue() = 0;
+    virtual int getType() { return 2; }
 };
 
-#if 0
 class FloatConfigControl : public VFloatConfigControl
 {
 public:
-    FloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
-                ConfigControl(a,b,c) {};
+    FloatConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                        QGridLayout *, int& );
+    FloatConfigControl( vlc_object_t *, module_config_t *,
+                        QLabel*, QDoubleSpinBox* );
     virtual ~FloatConfigControl() {};
     virtual float getValue();
-private:
+    virtual void show() { spin->show(); label->show(); }
+    virtual void hide() { spin->hide(); label->hide(); }
+
+protected:
     QDoubleSpinBox *spin;
+
+private:
+    QLabel *label;
+    void finish();
+};
+
+class FloatRangeConfigControl : public FloatConfigControl
+{
+public:
+    FloatRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                             QGridLayout *, int& );
+    FloatRangeConfigControl( vlc_object_t *, module_config_t *,
+                             QLabel*, QDoubleSpinBox* );
+private:
+    void finish();
 };
-#endif
 
 /*******************************************************
  * String-based controls
@@ -144,33 +211,78 @@ public:
                 ConfigControl(a,b) {};
     virtual ~VStringConfigControl() {};
     virtual QString getValue() = 0;
+    virtual int getType() { return 3; }
 };
 
 class StringConfigControl : public VStringConfigControl
 {
 public:
     StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                         bool pwd );
+                         QGridLayout *, int&,  bool pwd );
     StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                          QLineEdit*,  bool pwd );
     virtual ~StringConfigControl() {};
     virtual QString getValue() { return text->text(); };
+    virtual void show() { text->show(); label->show(); }
+    virtual void hide() { text->hide(); label->hide(); }
 private:
-    void finish( QLabel * );
+    void finish();
     QLineEdit *text;
+    QLabel *label;
 };
 
 class ModuleConfigControl : public VStringConfigControl
 {
 public:
-    ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
-                         bycat );
+    ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool,
+                         QGridLayout*, int& );
     ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                          QComboBox*, bool );
     virtual ~ModuleConfigControl() {};
     virtual QString getValue();
+    virtual void hide() { combo->hide(); label->hide(); }
+    virtual void show() { combo->show(); label->show(); }
+private:
+    void finish( bool );
+    QLabel *label;
+    QComboBox *combo;
+};
+
+class ModuleListConfigControl : public VStringConfigControl
+{
+    Q_OBJECT;
+public:
+    ModuleListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                             bool, QGridLayout*, int& );
+//    ModuleListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+//                         QComboBox*, bool );
+    virtual ~ModuleListConfigControl();
+    virtual QString getValue();
+    virtual void hide();
+    virtual void show();
+public slots:
+    void wakeUp_TheUserJustClickedOnSomething( int value );
+private:
+    void finish( bool );
+    QVector<QCheckBox*> modules;
+    QLabel *label;
+    QLineEdit *text;
+};
+
+class StringListConfigControl : public VStringConfigControl
+{
+public:
+    StringListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                             bool, QGridLayout*, int& );
+    StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+                             QComboBox*, bool );
+    virtual ~StringListConfigControl() {};
+    virtual QString getValue();
+    virtual void hide() { combo->hide(); label->hide(); }
+    virtual void show() { combo->show(); label->show(); }
 private:
-    void finish( QLabel *, bool );
+    void finish( bool );
+    QLabel *label;
     QComboBox *combo;
 };
 #if 0