]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/preferences_widgets.hpp
Qt: Remove leading line break on modules prefs help text
[vlc] / modules / gui / qt4 / components / preferences_widgets.hpp
index fca9457629ac73bc689a0ec647b652299b48eaa5..99a7957a311fc239e26ed369820a00135a232ae5 100644 (file)
@@ -43,7 +43,6 @@
 #include <QLabel>
 #include <QDoubleSpinBox>
 #include <QPushButton>
-#include <QVector>
 #include <QDialog>
 #include <QFontComboBox>
 
@@ -63,15 +62,20 @@ class InterfacePreviewWidget : public QLabel
     Q_OBJECT
 public:
     InterfacePreviewWidget( QWidget * );
+    enum enum_style {
+                 COMPLETE, // aka MPC
+                 MINIMAL,  // aka WMP12 minimal
+                 SKINS };
 public slots:
-    void setPreview( int );
+    void setPreview( enum_style );
+    void setNormalPreview( bool b_minimal );
 };
 
 /*******************************************************
  * Variable controls
  *******************************************************/
 
-class ConfigControl : public QObject
+class   ConfigControl : public QObject
 {
     Q_OBJECT
 public:
@@ -85,26 +89,22 @@ public:
     {
         widget = NULL;
     }
-    virtual ~ConfigControl() {};
-    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 int getType() const = 0;
+    const char * getName() const { return  p_item->psz_name; }
+    QWidget *getWidget() const { assert( widget ); return widget; }
+    bool isAdvanced() const { 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 *);
+                                          QGridLayout *, int line = 0 );
+    virtual void doApply() = 0;
 protected:
     vlc_object_t *p_this;
     module_config_t *p_item;
     QString _name;
     QWidget *widget;
-    bool _advanced;
 #if 0
 /* You shouldn't use that now..*/
 signals:
@@ -123,9 +123,9 @@ public:
             ConfigControl(a,b,c) {};
     VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
                 ConfigControl(a,b) {};
-    virtual ~VIntConfigControl() {};
-    virtual int getValue() = 0;
-    virtual int getType() { return CONFIG_ITEM_INTEGER; }
+    virtual int getValue() const = 0;
+    virtual int getType() const { return CONFIG_ITEM_INTEGER; }
+    virtual void doApply();
 };
 
 class IntegerConfigControl : public VIntConfigControl
@@ -133,15 +133,14 @@ 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(); if( label ) label->show(); }
-    virtual void hide() { spin->hide(); if( label ) label->hide(); }
+    virtual int getValue() const;
+    virtual void show() const { spin->show(); if( label ) label->show(); }
+    virtual void hide() const { spin->hide(); if( label ) label->hide(); }
 
 protected:
     QSpinBox *spin;
@@ -154,7 +153,7 @@ class IntegerRangeConfigControl : public IntegerConfigControl
 {
 public:
     IntegerRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                               QGridLayout *, int& );
+                               QGridLayout *, int );
     IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
                                QLabel*, QSpinBox* );
 private:
@@ -166,8 +165,7 @@ class IntegerRangeSliderConfigControl : public VIntConfigControl
 public:
     IntegerRangeSliderConfigControl( vlc_object_t *, module_config_t *,
                                 QLabel *, QSlider * );
-    virtual ~IntegerRangeSliderConfigControl() {};
-    virtual int getValue();
+    virtual int getValue() const;
 protected:
          QSlider *slider;
 private:
@@ -180,15 +178,14 @@ class IntegerListConfigControl : public VIntConfigControl
 Q_OBJECT
 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() {};
-    virtual int getValue();
+    virtual int getValue() const;
     virtual void hide() { combo->hide(); if( label ) label->hide(); }
     virtual void show() { combo->show(); if( label ) label->show(); }
 private:
-    void finish(module_config_t *, bool );
+    void finish(module_config_t * );
     QLabel *label;
     QComboBox *combo;
 private slots:
@@ -200,14 +197,13 @@ 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 *, QAbstractButton*, bool );
-    virtual ~BoolConfigControl() {};
-    virtual int getValue();
+                       QLabel *, QAbstractButton* );
+    virtual int getValue() const;
     virtual void show() { checkbox->show(); }
     virtual void hide() { checkbox->hide(); }
-    virtual int getType() { return CONFIG_ITEM_BOOL; }
+    virtual int getType() const { return CONFIG_ITEM_BOOL; }
 private:
     QAbstractButton *checkbox;
     void finish();
@@ -224,9 +220,9 @@ public:
                 ConfigControl(a,b,c) {};
     VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
                 ConfigControl(a,b) {};
-    virtual ~VFloatConfigControl() {};
-    virtual float getValue() = 0;
-    virtual int getType() { return CONFIG_ITEM_FLOAT; }
+    virtual float getValue() const = 0;
+    virtual int getType() const { return CONFIG_ITEM_FLOAT; }
+    virtual void doApply();
 };
 
 class FloatConfigControl : public VFloatConfigControl
@@ -234,11 +230,10 @@ class FloatConfigControl : public VFloatConfigControl
     Q_OBJECT
 public:
     FloatConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                        QGridLayout *, int& );
+                        QGridLayout *, int );
     FloatConfigControl( vlc_object_t *, module_config_t *,
                         QLabel*, QDoubleSpinBox* );
-    virtual ~FloatConfigControl() {};
-    virtual float getValue();
+    virtual float getValue() const;
     virtual void show() { spin->show(); if( label ) label->show(); }
     virtual void hide() { spin->hide(); if( label ) label->hide(); }
 
@@ -255,7 +250,7 @@ class FloatRangeConfigControl : public FloatConfigControl
     Q_OBJECT
 public:
     FloatRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                             QGridLayout *, int& );
+                             QGridLayout *, int );
     FloatRangeConfigControl( vlc_object_t *, module_config_t *,
                              QLabel*, QDoubleSpinBox* );
 private:
@@ -273,9 +268,9 @@ public:
                 ConfigControl(a,b,c) {};
     VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
                 ConfigControl(a,b) {};
-    virtual ~VStringConfigControl() {};
-    virtual QString getValue() = 0;
-    virtual int getType() { return CONFIG_ITEM_STRING; }
+    virtual QString getValue() const = 0;
+    virtual int getType() const { return CONFIG_ITEM_STRING; }
+    virtual void doApply();
 };
 
 class StringConfigControl : public VStringConfigControl
@@ -283,11 +278,10 @@ 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() {};
-    virtual QString getValue() { return text->text(); };
+    virtual QString getValue() const { return text->text(); };
     virtual void show() { text->show(); if( label ) label->show(); }
     virtual void hide() { text->hide(); if( label ) label->hide(); }
 private:
@@ -298,14 +292,13 @@ private:
 
 class FileConfigControl : public VStringConfigControl
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     FileConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                       QGridLayout *, int& );
+                       QGridLayout *, int );
     FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                        QLineEdit *, QPushButton * );
-    virtual ~FileConfigControl() {};
-    virtual QString getValue() { return text->text(); };
+    virtual QString getValue() const { return text->text(); };
     virtual void show() { text->show(); if( label ) label->show(); browse->show(); }
     virtual void hide() { text->hide(); if( label ) label->hide(); browse->hide(); }
 public slots:
@@ -319,27 +312,25 @@ protected:
 
 class DirectoryConfigControl : public FileConfigControl
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                            QGridLayout *, int& );
+                            QGridLayout *, int );
     DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                             QLineEdit *, QPushButton * );
-    virtual ~DirectoryConfigControl() {};
 public slots:
     virtual void updateField();
 };
 
 class FontConfigControl : public VStringConfigControl
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     FontConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                       QGridLayout *, int&);
+                       QGridLayout *, int);
     FontConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                        QFontComboBox *);
-    virtual ~FontConfigControl() {};
-    virtual QString getValue(){ return font->currentFont().toString(); }
+    virtual QString getValue() const { return font->currentFont().family(); }
 protected:
     QLabel *label;
     QFontComboBox *font;
@@ -349,11 +340,10 @@ 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() {};
-    virtual QString getValue();
+    virtual QString getValue() const;
     virtual void hide() { combo->hide(); if( label ) label->hide(); }
     virtual void show() { combo->show(); if( label ) label->show(); }
 private:
@@ -369,41 +359,40 @@ struct checkBoxListItem {
 
 class ModuleListConfigControl : public VStringConfigControl
 {
-    Q_OBJECT;
+    Q_OBJECT
     friend class ConfigControl;
 public:
     ModuleListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                             bool, QGridLayout*, int& );
+                             bool, QGridLayout*, int );
 //    ModuleListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
 //                         QComboBox*, bool );
     virtual ~ModuleListConfigControl();
-    virtual QString getValue();
+    virtual QString getValue() const;
     virtual void hide();
     virtual void show();
 public slots:
     void onUpdate();
 private:
     void finish( bool );
-    QVector<checkBoxListItem*> modules;
+    QList<checkBoxListItem*> modules;
     QGroupBox *groupBox;
     QLineEdit *text;
 };
 
 class StringListConfigControl : public VStringConfigControl
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     StringListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                             bool, QGridLayout*, int& );
+                             QGridLayout*, int );
     StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
                              QComboBox*, bool );
-    virtual ~StringListConfigControl() {};
-    virtual QString getValue();
+    virtual QString getValue() const;
     virtual void hide() { combo->hide(); if( label ) label->hide(); }
     virtual void show() { combo->show(); if( label ) label->show(); }
     QComboBox *combo;
 private:
-    void finish(module_config_t *, bool );
+    void finish(module_config_t * );
     QLabel *label;
 private slots:
     void actionRequested( int );
@@ -439,17 +428,17 @@ private slot:
  **********************************************************************/
 class KeyShortcutEdit: public QLineEdit
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
-    void setValue( int _value ){ value = _value; }
-    int getValue() const { return value; }
+    void setValue( const QString& value ){ this->value = value; }
+    QString getValue() const { return value; }
 
     void setGlobal( bool _value ) { b_global = _value; }
-    bool getGlobal()  const { return b_global; }
+    bool getGlobal() const { return b_global; }
 public slots:
-    virtual void clear(void) { value = 0; QLineEdit::clear(); b_global = false;}
+    virtual void clear(void) { value = qfu(""); QLineEdit::clear(); }
 private:
-    int value;
+    QString value;
     bool b_global;
     virtual void mousePressEvent( QMouseEvent *event );
 signals:
@@ -459,15 +448,14 @@ signals:
 class SearchLineEdit;
 class KeySelectorControl : public ConfigControl
 {
-    Q_OBJECT;
+    Q_OBJECT
 public:
     KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *,
-                        QGridLayout*, int& );
-    virtual int getType() { return CONFIG_ITEM_KEY; }
-    virtual ~KeySelectorControl() {};
+                        QGridLayout*, int );
+    virtual int getType() const { return CONFIG_ITEM_KEY; }
     virtual void hide() { table->hide(); if( label ) label->hide(); }
     virtual void show() { table->show(); if( label ) label->show(); }
-    void doApply();
+    virtual void doApply();
 private:
     void finish();
     QLabel *label;
@@ -478,6 +466,7 @@ private:
 private slots:
     void setTheKey();
     void selectKey( QTreeWidgetItem * = NULL, int column = 1 );
+    void select( QTreeWidgetItem * = NULL, int column = 1 );
     void select1Key();
     void filter( const QString & );
 };