From 25d716307a5ce3ae8a037112ceeaeefc48df29c3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Fri, 15 Apr 2011 15:53:08 +0200 Subject: [PATCH] qt4: preferences_widget: Adding some 'const' Signed-off-by: Jean-Baptiste Kempf --- .../qt4/components/preferences_widgets.cpp | 16 +++--- .../qt4/components/preferences_widgets.hpp | 52 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/modules/gui/qt4/components/preferences_widgets.cpp b/modules/gui/qt4/components/preferences_widgets.cpp index b97521a5df..84cc19a35f 100644 --- a/modules/gui/qt4/components/preferences_widgets.cpp +++ b/modules/gui/qt4/components/preferences_widgets.cpp @@ -560,7 +560,7 @@ void StringListConfigControl::finish(module_config_t *p_module_config, bool byca label->setBuddy( combo ); } -QString StringListConfigControl::getValue() +QString StringListConfigControl::getValue() const { return combo->itemData( combo->currentIndex() ).toString(); } @@ -685,7 +685,7 @@ void ModuleConfigControl::finish( bool bycat ) label->setBuddy( combo ); } -QString ModuleConfigControl::getValue() +QString ModuleConfigControl::getValue() const { return combo->itemData( combo->currentIndex() ).toString(); } @@ -803,7 +803,7 @@ void ModuleListConfigControl::finish( bool bycat ) } #undef CHECKBOX_LISTS -QString ModuleListConfigControl::getValue() +QString ModuleListConfigControl::getValue() const { assert( text ); return text->text(); @@ -909,7 +909,7 @@ void IntegerConfigControl::finish() label->setBuddy( spin ); } -int IntegerConfigControl::getValue() +int IntegerConfigControl::getValue() const { return spin->value(); } @@ -960,7 +960,7 @@ IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl( label->setBuddy( slider ); } -int IntegerRangeSliderConfigControl::getValue() +int IntegerRangeSliderConfigControl::getValue() const { return slider->value(); } @@ -1081,7 +1081,7 @@ void IntegerListConfigControl::actionRequested( int i_action ) } } -int IntegerListConfigControl::getValue() +int IntegerListConfigControl::getValue() const { return combo->itemData( combo->currentIndex() ).toInt(); } @@ -1127,7 +1127,7 @@ void BoolConfigControl::finish() checkbox->setToolTip( formatTooltip(qtr(p_item->psz_longtext)) ); } -int BoolConfigControl::getValue() +int BoolConfigControl::getValue() const { return checkbox->isChecked(); } @@ -1191,7 +1191,7 @@ void FloatConfigControl::finish() label->setBuddy( spin ); } -float FloatConfigControl::getValue() +float FloatConfigControl::getValue() const { return (float)spin->value(); } diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index 312e075b06..a22b07ea4f 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -91,10 +91,10 @@ 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(); }; @@ -128,8 +128,8 @@ public: 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; } }; class IntegerConfigControl : public VIntConfigControl @@ -143,9 +143,9 @@ public: 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; @@ -171,7 +171,7 @@ public: IntegerRangeSliderConfigControl( vlc_object_t *, module_config_t *, QLabel *, QSlider * ); virtual ~IntegerRangeSliderConfigControl() {}; - virtual int getValue(); + virtual int getValue() const; protected: QSlider *slider; private: @@ -188,7 +188,7 @@ public: 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: @@ -208,10 +208,10 @@ public: BoolConfigControl( vlc_object_t *, module_config_t *, QLabel *, QAbstractButton*, bool ); virtual ~BoolConfigControl() {}; - virtual int getValue(); + 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(); @@ -229,8 +229,8 @@ public: 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; } }; class FloatConfigControl : public VFloatConfigControl @@ -242,7 +242,7 @@ public: 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(); } @@ -278,8 +278,8 @@ public: 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; } }; class StringConfigControl : public VStringConfigControl @@ -291,7 +291,7 @@ public: 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: @@ -309,7 +309,7 @@ public: 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: @@ -343,7 +343,7 @@ public: FontConfigControl( vlc_object_t *, module_config_t *, QLabel *, QFontComboBox *); virtual ~FontConfigControl() {}; - virtual QString getValue(){ return font->currentFont().family(); } + virtual QString getValue() const { return font->currentFont().family(); } protected: QLabel *label; QFontComboBox *font; @@ -357,7 +357,7 @@ public: 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: @@ -381,7 +381,7 @@ public: // 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: @@ -402,7 +402,7 @@ public: 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; @@ -449,7 +449,7 @@ public: 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 = qfu(""); QLineEdit::clear(); } private: @@ -467,7 +467,7 @@ class KeySelectorControl : public ConfigControl public: KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *, QGridLayout*, int& ); - virtual int getType() { return CONFIG_ITEM_KEY; } + virtual int getType() const { return CONFIG_ITEM_KEY; } virtual ~KeySelectorControl() {}; virtual void hide() { table->hide(); if( label ) label->hide(); } virtual void show() { table->show(); if( label ) label->show(); } -- 2.39.2