[vlc-commits] Qt: ConfigControl: enforce use of factory or non virtual class constructors

Francois Cartegnie git at videolan.org
Mon Mar 26 14:12:13 CEST 2012


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Mar 26 13:54:35 2012 +0200| [c8566c0ae81db4224c09ced87d43711fd1a49e4c] | committer: Francois Cartegnie

Qt: ConfigControl: enforce use of factory or non virtual class constructors

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c8566c0ae81db4224c09ced87d43711fd1a49e4c
---

 modules/gui/qt4/components/preferences_widgets.hpp |   41 ++++++++++---------
 1 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp
index 473548c..6aed2c4 100644
--- a/modules/gui/qt4/components/preferences_widgets.hpp
+++ b/modules/gui/qt4/components/preferences_widgets.hpp
@@ -79,16 +79,6 @@ class ConfigControl : public QObject
 {
     Q_OBJECT
 public:
-    ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
-                   QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
-    {
-        widget = NULL;
-    }
-    ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
-                            p_this (_p_this ), p_item( _p_conf )
-    {
-        widget = NULL;
-    }
     virtual int getType() const = 0;
     const char * getName() const { return  p_item->psz_name; }
     QWidget *getWidget() const { return widget; }
@@ -101,6 +91,16 @@ public:
                                           QGridLayout *, int line = 0 );
     virtual void doApply() = 0;
 protected:
+    ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
+                   QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
+    {
+        widget = NULL;
+    }
+    ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
+                            p_this (_p_this ), p_item( _p_conf )
+    {
+        widget = NULL;
+    }
     vlc_object_t *p_this;
     module_config_t *p_item;
     QString _name;
@@ -119,13 +119,14 @@ class VIntConfigControl : public ConfigControl
 {
 Q_OBJECT
 public:
+    virtual int getValue() const = 0;
+    virtual int getType() const;
+    virtual void doApply();
+protected:
     VIntConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
             ConfigControl(a,b,c) {};
     VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
                 ConfigControl(a,b) {};
-    virtual int getValue() const = 0;
-    virtual int getType() const;
-    virtual void doApply();
 };
 
 class IntegerConfigControl : public VIntConfigControl
@@ -236,13 +237,14 @@ class VFloatConfigControl : public ConfigControl
 {
     Q_OBJECT
 public:
+    virtual float getValue() const = 0;
+    virtual int getType() const;
+    virtual void doApply();
+protected:
     VFloatConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
                 ConfigControl(a,b,c) {};
     VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
                 ConfigControl(a,b) {};
-    virtual float getValue() const = 0;
-    virtual int getType() const;
-    virtual void doApply();
 };
 
 class FloatConfigControl : public VFloatConfigControl
@@ -284,13 +286,14 @@ class VStringConfigControl : public ConfigControl
 {
     Q_OBJECT
 public:
+    virtual QString getValue() const = 0;
+    virtual int getType() const;
+    virtual void doApply();
+protected:
     VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
                 ConfigControl(a,b,c) {};
     VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
                 ConfigControl(a,b) {};
-    virtual QString getValue() const = 0;
-    virtual int getType() const;
-    virtual void doApply();
 };
 
 class StringConfigControl : public VStringConfigControl



More information about the vlc-commits mailing list