瀏覽代碼

Provide separate variable names for image and file input and output widgets

MattClarkson 13 年之前
父節點
當前提交
639eec660a

+ 44 - 18
Libs/CommandLineModules/Core/Resources/ctkCmdLineModuleXmlToQtUi.xsl

@@ -321,22 +321,35 @@
   
   <!--
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    IMAGE, GEOMETRY parameter (default: ctkPathLineEdit)
+    IMAGE parameter (default: ctkPathLineEdit)
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   -->
 
-  <xsl:template match="parameters/*[name()=('image', 'geometry')]">
+  <xsl:template match="parameters/*[name()=('image')]">
     <xsl:call-template name="gridItemWithLabel"/>
     <item  row="{position()-1}" column="1">
       <layout class="QHBoxLayout">
         <item>
-          <widget class="{$imageWidget}"  name="parameter:{name}">
-            <xsl:call-template name="commonWidgetProperties"/>
-            <xsl:call-template name="createQtDesignerStringListProperty"/>
-            <property name="filters">
-              <set>ctkPathLineEdit::Files</set>
-            </property>
-          </widget>
+          <xsl:choose>
+            <xsl:when test="channel = 'input'">
+              <widget class="{$imageInputWidget}"  name="parameter:{name}">
+                <xsl:call-template name="commonWidgetProperties"/>
+                <xsl:call-template name="createQtDesignerStringListProperty"/>
+                <property name="filters">
+                  <set>ctkPathLineEdit::Files</set>
+                </property>
+              </widget>
+            </xsl:when>
+            <xsl:otherwise>
+              <widget class="{$imageOutputWidget}"  name="parameter:{name}">
+                <xsl:call-template name="commonWidgetProperties"/>
+                <xsl:call-template name="createQtDesignerStringListProperty"/>
+                <property name="filters">
+                  <set>ctkPathLineEdit::Files</set>
+                </property>
+              </widget>
+            </xsl:otherwise>
+          </xsl:choose>
         </item>
         <item>
           <widget class="QPushButton"  name="{name}BrowseButton">
@@ -351,22 +364,35 @@
 
   <!--
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    FILE parameter (default: ctkPathLineEdit)
+    FILE, GEOMETRY parameter (default: ctkPathLineEdit)
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   -->
 
-  <xsl:template match="parameters/*[name()=('file')]">
+  <xsl:template match="parameters/*[name()=('file', 'geometry')]">
     <xsl:call-template name="gridItemWithLabel"/>
     <item  row="{position()-1}" column="1">
       <layout class="QHBoxLayout">
         <item>
-          <widget class="{$fileWidget}"  name="parameter:{name}">
-            <xsl:call-template name="commonWidgetProperties"/>
-            <xsl:call-template name="createQtDesignerStringListProperty"/>
-            <property name="filters">
-              <set>ctkPathLineEdit::Files</set>
-            </property>
-          </widget>
+          <xsl:choose>
+            <xsl:when test="channel = 'input'">
+              <widget class="{$fileInputWidget}"  name="parameter:{name}">
+                <xsl:call-template name="commonWidgetProperties"/>
+                <xsl:call-template name="createQtDesignerStringListProperty"/>
+                <property name="filters">
+                  <set>ctkPathLineEdit::Files</set>
+                </property>
+              </widget>
+            </xsl:when>
+            <xsl:otherwise>
+              <widget class="{$fileOutputWidget}"  name="parameter:{name}">
+                <xsl:call-template name="commonWidgetProperties"/>
+                <xsl:call-template name="createQtDesignerStringListProperty"/>
+                <property name="filters">
+                  <set>ctkPathLineEdit::Files</set>
+                </property>
+              </widget>
+            </xsl:otherwise>
+          </xsl:choose>
         </item>
         <item>
           <widget class="QPushButton"  name="{name}BrowseButton">

+ 4 - 2
Libs/CommandLineModules/Core/ctkCmdLineModuleXslTransform.cpp

@@ -119,8 +119,10 @@ ctkCmdLineModuleXslTransform::ctkCmdLineModuleXslTransform(QIODevice *input, QIO
   this->bindVariable("floatingWidget", QVariant(QString("QDoubleSpinBox")));
   this->bindVariable("vectorWidget", QVariant(QString("QLineEdit")));
   this->bindVariable("enumWidget", QVariant(QString("QComboBox")));
-  this->bindVariable("imageWidget", QVariant(QString("ctkPathLineEdit")));
-  this->bindVariable("fileWidget", QVariant(QString("ctkPathLineEdit")));
+  this->bindVariable("imageInputWidget", QVariant(QString("ctkPathLineEdit")));
+  this->bindVariable("imageOutputWidget", QVariant(QString("ctkPathLineEdit")));
+  this->bindVariable("fileInputWidget", QVariant(QString("ctkPathLineEdit")));
+  this->bindVariable("fileOutputWidget", QVariant(QString("ctkPathLineEdit")));
   this->bindVariable("directoryWidget", QVariant(QString("ctkPathLineEdit")));
   this->bindVariable("pointWidget", QVariant(QString("ctkCoordinatesWidget")));
   this->bindVariable("unsupportedWidget", QVariant(QString("QLabel")));