]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/preferences_widgets.hpp
Qt4 - Pref: start to track functionnalities missing. Directory still segfaults..
[vlc] / modules / gui / qt4 / components / preferences_widgets.hpp
index 047da15a5ee4b7a5dcf4c69774a33169a883760b..41b6177a199fe418dbe6fa6fa80ba6e819e01ec0 100644 (file)
@@ -6,6 +6,7 @@
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
  *          Antoine Cellerier <dionoea@videolan.org>
+ *          Jean-Baptiste Kempf <jb@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
 #define _INFOPANELS_H_
 #include <vlc/vlc.h>
 #include <QWidget>
+#include <QTreeWidget>
 #include <QLineEdit>
 #include <QSpinBox>
+#include <QDoubleSpinBox>
 #include <QComboBox>
 #include <QCheckBox>
-#include "ui/input_stats.h"
+#include <QVector>
+#include <QDialog>
+#include <QLabel>
+#include <QFile>
+#include <QPushButton>
+
 #include "qt4.hpp"
 #include <assert.h>
 
+class QGridLayout;
+
 class ConfigControl : public QObject
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
                    QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
@@ -49,7 +59,8 @@ public:
         widget = NULL;
     }
     virtual ~ConfigControl() {};
-    QString getName() { return qfu( p_item->psz_name ); }
+    virtual int getType() = 0;
+    const 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(); };
@@ -59,7 +70,8 @@ public:
                                           module_config_t*,QWidget* );
     static ConfigControl * createControl( vlc_object_t*,
                                           module_config_t*,QWidget*,
-                                          QGridLayout *, int);
+                                          QGridLayout *, int& );
+    void doApply( intf_thread_t *);
 protected:
     vlc_object_t *p_this;
     module_config_t *p_item;
@@ -75,6 +87,7 @@ signals:
  *******************************************************/
 class VIntConfigControl : public ConfigControl
 {
+Q_OBJECT
 public:
     VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
             ConfigControl(a,b,c) {};
@@ -82,30 +95,61 @@ public:
                 ConfigControl(a,b) {};
     virtual ~VIntConfigControl() {};
     virtual int getValue() = 0;
+    virtual int getType() { return 1; }
 };
 
 class IntegerConfigControl : public VIntConfigControl
 {
+Q_OBJECT
 public:
     IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                          QGridLayout *, int );
+                          QGridLayout *, int& );
     IntegerConfigControl( vlc_object_t *, module_config_t *,
                           QLabel*, QSpinBox* );
+    IntegerConfigControl( vlc_object_t *, module_config_t *,
+                          QLabel*, QSlider* );
     virtual ~IntegerConfigControl() {};
     virtual int getValue();
     virtual void show() { spin->show(); label->show(); }
     virtual void hide() { spin->hide(); label->hide(); }
-private:
+
+protected:
     QSpinBox *spin;
+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 IntegerRangeSliderConfigControl : public VIntConfigControl
+{
+public:
+    IntegerRangeSliderConfigControl( vlc_object_t *, module_config_t *,
+                                QLabel *, QSlider * );
+    virtual ~IntegerRangeSliderConfigControl() {};
+    virtual int getValue();
+protected:
+         QSlider *slider;
+private:
+         QLabel *label;
+         void finish();
+};
+
 class IntegerListConfigControl : public VIntConfigControl
 {
 public:
     IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                              bool, QGridLayout*, int );
+                              bool, QGridLayout*, int& );
     IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                               QComboBox*, bool );
     virtual ~IntegerListConfigControl() {};
@@ -122,7 +166,7 @@ class BoolConfigControl : public VIntConfigControl
 {
 public:
     BoolConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                       QGridLayout *, int );
+                       QGridLayout *, int& );
     BoolConfigControl( vlc_object_t *, module_config_t *,
                        QLabel *, QCheckBox*, bool );
     virtual ~BoolConfigControl() {};
@@ -139,6 +183,7 @@ private:
  *******************************************************/
 class VFloatConfigControl : public ConfigControl
 {
+    Q_OBJECT
 public:
     VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
                 ConfigControl(a,b,c) {};
@@ -146,26 +191,48 @@ public:
                 ConfigControl(a,b) {};
     virtual ~VFloatConfigControl() {};
     virtual float getValue() = 0;
+    virtual int getType() { return 2; }
 };
 
-#if 0
 class FloatConfigControl : public VFloatConfigControl
 {
+    Q_OBJECT
 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
+{
+    Q_OBJECT
+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
  *******************************************************/
 class VStringConfigControl : public ConfigControl
 {
+    Q_OBJECT
 public:
     VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
                 ConfigControl(a,b,c) {};
@@ -173,13 +240,15 @@ public:
                 ConfigControl(a,b) {};
     virtual ~VStringConfigControl() {};
     virtual QString getValue() = 0;
+    virtual int getType() { return 3; }
 };
 
 class StringConfigControl : public VStringConfigControl
 {
+    Q_OBJECT
 public:
     StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                         QGridLayout *, int,  bool pwd );
+                         QGridLayout *, int&,  bool pwd );
     StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                          QLineEdit*,  bool pwd );
     virtual ~StringConfigControl() {};
@@ -192,11 +261,53 @@ private:
     QLabel *label;
 };
 
+class FileConfigControl : public VStringConfigControl
+{
+    Q_OBJECT;
+public:
+    FileConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                         QGridLayout *, int&, bool pwd );
+    FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+                        QLineEdit *, QPushButton *, bool pwd );
+    virtual ~FileConfigControl() {};
+    virtual QString getValue() { return text->text(); };
+    virtual void show() { text->show(); label->show(); browse->show(); }
+    virtual void hide() { text->hide(); label->hide(); browse->hide(); }
+public slots:
+    virtual void updateField();
+protected:
+    void finish();
+private:
+    QLineEdit *text;
+    QLabel *label;
+    QPushButton *browse;
+};
+
+class DirectoryConfigControl : public FileConfigControl
+{
+    Q_OBJECT;
+public:
+    DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+                         QGridLayout *, int&, bool pwd );
+    DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+                        QLineEdit *, QPushButton *, bool pwd );
+    virtual ~DirectoryConfigControl() {};
+    virtual QString getValue() { return text->text(); };
+    virtual void show() { text->show(); label->show(); browse->show(); }
+    virtual void hide() { text->hide(); label->hide(); browse->hide(); }
+public slots:
+    virtual void updateField();
+private:
+    QLineEdit *text;
+    QLabel *label;
+    QPushButton *browse;
+};
+
 class ModuleConfigControl : public VStringConfigControl
 {
 public:
     ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool,
-                         QGridLayout*, int );
+                         QGridLayout*, int& );
     ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                          QComboBox*, bool );
     virtual ~ModuleConfigControl() {};
@@ -209,11 +320,32 @@ private:
     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 );
+                             bool, QGridLayout*, int& );
     StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                              QComboBox*, bool );
     virtual ~StringListConfigControl() {};
@@ -246,4 +378,41 @@ private slot:
 };
 #endif
 
+/**********************************************************************
+ * Key selector widget
+ **********************************************************************/
+class KeyInputDialog : public QDialog
+{
+public:
+    KeyInputDialog( QList<module_config_t *> &, const char * );
+    int keyValue;
+    bool conflicts;
+private:
+    void keyPressEvent( QKeyEvent *);
+    QLabel *selected;
+    QLabel *warning;
+    const char * keyToChange;
+    QList<module_config_t*> values;
+};
+
+class KeySelectorControl : public ConfigControl
+{
+    Q_OBJECT;
+public:
+    KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *,
+                        QGridLayout*, int& );
+    virtual int getType() { return 4; }
+    virtual ~KeySelectorControl() {};
+    virtual void hide() { table->hide(); label->hide(); }
+    virtual void show() { table->show(); label->show(); }
+    void doApply();
+private:
+    void finish();
+    QLabel *label;
+    QTreeWidget *table;
+    QList<module_config_t *> values;
+private slots:
+    void selectKey( QTreeWidgetItem *);
+};
+
 #endif