Commit 68c5c803 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: ConfigControl: unify and fix visibility changes.

Visibility changes were not applied to the created qwidget
except for base class.
Changes were also not implemented for some classes.
parent e84b9525
...@@ -822,21 +822,14 @@ QString ModuleListConfigControl::getValue() const ...@@ -822,21 +822,14 @@ QString ModuleListConfigControl::getValue() const
return text->text(); return text->text();
} }
void ModuleListConfigControl::hide() void ModuleListConfigControl::changeVisibility( bool b )
{ {
foreach ( checkBoxListItem *it, modules ) foreach ( checkBoxListItem *it, modules )
it->checkBox->hide(); it->checkBox->setVisible( b );
groupBox->hide(); groupBox->setVisible( b );
ConfigControl::changeVisibility( b );
} }
void ModuleListConfigControl::show()
{
foreach ( checkBoxListItem *it, modules )
it->checkBox->show();
groupBox->show();
}
void ModuleListConfigControl::onUpdate() void ModuleListConfigControl::onUpdate()
{ {
text->clear(); text->clear();
......
...@@ -83,8 +83,8 @@ public: ...@@ -83,8 +83,8 @@ public:
const char * getName() const { return p_item->psz_name; } const char * getName() const { return p_item->psz_name; }
QWidget *getWidget() const { return widget; } QWidget *getWidget() const { return widget; }
bool isAdvanced() const { return p_item->b_advanced; } bool isAdvanced() const { return p_item->b_advanced; }
virtual void hide() { if ( widget ) widget->hide(); }; void hide() { changeVisibility( false ); }
virtual void show() { if ( widget ) widget->show(); }; void show() { changeVisibility( true ); }
static ConfigControl * createControl( vlc_object_t*, static ConfigControl * createControl( vlc_object_t*,
module_config_t*,QWidget*, module_config_t*,QWidget*,
...@@ -93,14 +93,11 @@ public: ...@@ -93,14 +93,11 @@ public:
protected: protected:
ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf, ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
QWidget *p ) : p_this( _p_this ), p_item( _p_conf ) QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
{ { widget = NULL; }
widget = NULL;
}
ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) : ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
p_this (_p_this ), p_item( _p_conf ) p_this (_p_this ), p_item( _p_conf )
{ { widget = NULL; }
widget = NULL; virtual void changeVisibility( bool b ) { if ( widget ) widget->setVisible( b ); }
}
vlc_object_t *p_this; vlc_object_t *p_this;
module_config_t *p_item; module_config_t *p_item;
QWidget *widget; QWidget *widget;
...@@ -139,11 +136,14 @@ public: ...@@ -139,11 +136,14 @@ public:
IntegerConfigControl( vlc_object_t *, module_config_t *, IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSlider* ); QLabel*, QSlider* );
virtual int getValue() const; virtual int getValue() const;
virtual void show() { spin->show(); if( label ) label->show(); }
virtual void hide() { spin->hide(); if( label ) label->hide(); }
protected: protected:
QSpinBox *spin; QSpinBox *spin;
virtual void changeVisibility( bool b )
{
spin->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
QLabel *label; QLabel *label;
void finish(); void finish();
...@@ -168,6 +168,12 @@ public: ...@@ -168,6 +168,12 @@ public:
virtual int getValue() const; virtual int getValue() const;
protected: protected:
QSlider *slider; QSlider *slider;
virtual void changeVisibility( bool b )
{
slider->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
QLabel *label; QLabel *label;
void finish(); void finish();
...@@ -182,8 +188,13 @@ public: ...@@ -182,8 +188,13 @@ public:
IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *, IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool ); QComboBox*, bool );
virtual int getValue() const; virtual int getValue() const;
virtual void hide() { combo->hide(); if( label ) label->hide(); } protected:
virtual void show() { combo->show(); if( label ) label->show(); } virtual void changeVisibility( bool b )
{
combo->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
void finish(module_config_t * ); void finish(module_config_t * );
QLabel *label; QLabel *label;
...@@ -201,9 +212,13 @@ public: ...@@ -201,9 +212,13 @@ public:
BoolConfigControl( vlc_object_t *, module_config_t *, BoolConfigControl( vlc_object_t *, module_config_t *,
QLabel *, QAbstractButton* ); QLabel *, QAbstractButton* );
virtual int getValue() const; virtual int getValue() const;
virtual void show() { checkbox->show(); }
virtual void hide() { checkbox->hide(); }
virtual int getType() const; virtual int getType() const;
protected:
virtual void changeVisibility( bool b )
{
checkbox->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
QAbstractButton *checkbox; QAbstractButton *checkbox;
void finish(); void finish();
...@@ -219,6 +234,13 @@ public: ...@@ -219,6 +234,13 @@ public:
QLabel *, QAbstractButton* ); QLabel *, QAbstractButton* );
virtual ~ColorConfigControl() { delete color_px; } virtual ~ColorConfigControl() { delete color_px; }
virtual int getValue() const; virtual int getValue() const;
protected:
virtual void changeVisibility( bool b )
{
color_but->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
QLabel *label; QLabel *label;
QAbstractButton *color_but; QAbstractButton *color_but;
...@@ -255,10 +277,14 @@ public: ...@@ -255,10 +277,14 @@ public:
FloatConfigControl( vlc_object_t *, module_config_t *, FloatConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QDoubleSpinBox* ); QLabel*, QDoubleSpinBox* );
virtual float getValue() const; virtual float getValue() const;
virtual void show() { spin->show(); if( label ) label->show(); }
virtual void hide() { spin->hide(); if( label ) label->hide(); }
protected: protected:
virtual void changeVisibility( bool b )
{
spin->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
QDoubleSpinBox *spin; QDoubleSpinBox *spin;
private: private:
...@@ -304,8 +330,13 @@ public: ...@@ -304,8 +330,13 @@ public:
StringConfigControl( vlc_object_t *, module_config_t *, QLabel *, StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit*, bool pwd ); QLineEdit*, bool pwd );
virtual QString getValue() const { return text->text(); }; virtual QString getValue() const { return text->text(); };
virtual void show() { text->show(); if( label ) label->show(); } protected:
virtual void hide() { text->hide(); if( label ) label->hide(); } virtual void changeVisibility( bool b )
{
text->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
void finish(); void finish();
QLineEdit *text; QLineEdit *text;
...@@ -321,11 +352,16 @@ public: ...@@ -321,11 +352,16 @@ public:
FileConfigControl( vlc_object_t *, module_config_t *, QLabel *, FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit *, QPushButton * ); QLineEdit *, QPushButton * );
virtual QString getValue() const { 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: public slots:
virtual void updateField(); virtual void updateField();
protected: protected:
virtual void changeVisibility( bool b )
{
text->setVisible( b );
browse->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
void finish(); void finish();
QLineEdit *text; QLineEdit *text;
QLabel *label; QLabel *label;
...@@ -354,6 +390,12 @@ public: ...@@ -354,6 +390,12 @@ public:
QFontComboBox *); QFontComboBox *);
virtual QString getValue() const { return font->currentFont().family(); } virtual QString getValue() const { return font->currentFont().family(); }
protected: protected:
virtual void changeVisibility( bool b )
{
font->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
QLabel *label; QLabel *label;
QFontComboBox *font; QFontComboBox *font;
}; };
...@@ -366,8 +408,12 @@ public: ...@@ -366,8 +408,12 @@ public:
ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *, ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool ); QComboBox*, bool );
virtual QString getValue() const; virtual QString getValue() const;
virtual void hide() { combo->hide(); if( label ) label->hide(); } virtual void changeVisibility( bool b )
virtual void show() { combo->show(); if( label ) label->show(); } {
combo->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
void finish( bool ); void finish( bool );
QLabel *label; QLabel *label;
...@@ -390,10 +436,10 @@ public: ...@@ -390,10 +436,10 @@ public:
// QComboBox*, bool ); // QComboBox*, bool );
virtual ~ModuleListConfigControl(); virtual ~ModuleListConfigControl();
virtual QString getValue() const; virtual QString getValue() const;
virtual void hide();
virtual void show();
public slots: public slots:
void onUpdate(); void onUpdate();
protected:
virtual void changeVisibility( bool );
private: private:
void finish( bool ); void finish( bool );
void checkbox_lists(module_t*); void checkbox_lists(module_t*);
...@@ -412,8 +458,13 @@ public: ...@@ -412,8 +458,13 @@ public:
StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *, StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool ); QComboBox*, bool );
virtual QString getValue() const; virtual QString getValue() const;
virtual void hide() { combo->hide(); if( label ) label->hide(); } protected:
virtual void show() { combo->show(); if( label ) label->show(); } virtual void changeVisibility( bool b )
{
combo->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
QComboBox *combo; QComboBox *combo;
private: private:
void finish(module_config_t * ); void finish(module_config_t * );
...@@ -457,11 +508,15 @@ public: ...@@ -457,11 +508,15 @@ public:
KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *, KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *,
QGridLayout*, int ); QGridLayout*, int );
virtual int getType() const; virtual int getType() const;
virtual void hide() { table->hide(); if( label ) label->hide(); }
virtual void show() { table->show(); if( label ) label->show(); }
virtual void doApply(); virtual void doApply();
protected: protected:
virtual bool eventFilter( QObject *, QEvent * ); virtual bool eventFilter( QObject *, QEvent * );
virtual void changeVisibility( bool b )
{
table->setVisible( b );
if ( label ) label->setVisible( b );
ConfigControl::changeVisibility( b );
}
private: private:
void finish(); void finish();
QLabel *label; QLabel *label;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment