From 4a609e71e7fc9f573e0d303d6d20edd5785d830a Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Mon, 28 Mar 2011 16:57:54 +0200
Subject: [PATCH] ENH: prepare for new factories to come

---
 .../otbWrapperQtWidgetParameterFactory.cxx    | 26 ++++++++++++++-----
 .../otbWrapperQtWidgetParameterFactory.h      |  3 ---
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx b/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx
index 4acaad2828..f4a9d0af63 100644
--- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx
+++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.cxx
@@ -17,6 +17,11 @@
 =========================================================================*/
 #include "otbWrapperQtWidgetParameterFactory.h"
 
+#include "otbWrapperQtWidgetNumericalParameterFactory.h"
+#include "otbWrapperQtWidgetEmptyParameterFactory.h"
+#include "otbWrapperQtWidgetStringParameterFactory.h"
+#include "otbWrapperQtWidgetChoiceParameterFactory.h"
+
 namespace otb
 {
 namespace Wrapper
@@ -33,17 +38,26 @@ QtWidgetParameterFactory::~QtWidgetParameterFactory()
 
 }
 
-void
-QtWidgetParameterFactory::RegisterBuiltInFactories()
-{
-
-}
-
 QWidget*
 QtWidgetParameterFactory::CreateQtWidget( Parameter* param )
 {
 
+  QWidget* widget = 0;
+
+  if (!widget)
+    widget = QtWidgetIntParameterFactory::CreateQtWidget( param );
+
+  if (!widget)
+    widget = QtWidgetFloatParameterFactory::CreateQtWidget( param );
+
+  if (!widget)
+    widget = QtWidgetEmptyParameterFactory::CreateQtWidget( param );
+
+  if (!widget)
+    widget = QtWidgetStringParameterFactory::CreateQtWidget( param );
 
+  if (!widget)
+    widget = QtWidgetChoiceParameterFactory::CreateQtWidget( param );
 
   return 0;
 }
diff --git a/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h b/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h
index 15302cae0c..df5015958c 100644
--- a/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h
+++ b/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h
@@ -44,9 +44,6 @@ public:
   /** Create the appropriate ImageIO depending on the particulars of the file. */
   static QWidget* CreateQtWidget( Parameter* param );
 
-  /** Register Built-in factories */
-  static void RegisterBuiltInFactories();
-
 protected:
   QtWidgetParameterFactory();
   virtual ~QtWidgetParameterFactory();
-- 
GitLab