Browse Source

Separate xsl for file and image types

MattClarkson 13 years ago
parent
commit
0199f7dbfb

+ 33 - 3
Libs/CommandLineModules/Core/Resources/ctkCmdLineModuleXmlToQtUi.xsl

@@ -321,11 +321,11 @@
   
   <!--
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-    IMAGE, FILE, GEOMETRY parameter (default: ctkPathLineEdit)
+    IMAGE, GEOMETRY parameter (default: ctkPathLineEdit)
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   -->
 
-  <xsl:template match="parameters/*[name()=('image', 'file', 'geometry')]">
+  <xsl:template match="parameters/*[name()=('image', 'geometry')]">
     <xsl:call-template name="gridItemWithLabel"/>
     <item  row="{position()-1}" column="1">
       <layout class="QHBoxLayout">
@@ -348,7 +348,37 @@
       </layout>
     </item>
   </xsl:template>
-  
+
+  <!--
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+    FILE parameter (default: ctkPathLineEdit)
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  -->
+
+  <xsl:template match="parameters/*[name()=('file')]">
+    <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>
+        </item>
+        <item>
+          <widget class="QPushButton"  name="{name}BrowseButton">
+            <property name="text">
+              <string>Browse...</string>
+            </property>
+          </widget>
+        </item>
+      </layout>
+    </item>
+  </xsl:template>
+
   <!--
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     DIRECTORY parameter (default: ctkPathLineEdit)

+ 1 - 0
Libs/CommandLineModules/Core/ctkCmdLineModuleXslTransform.cpp

@@ -120,6 +120,7 @@ ctkCmdLineModuleXslTransform::ctkCmdLineModuleXslTransform(QIODevice *input, QIO
   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("directoryWidget", QVariant(QString("ctkPathLineEdit")));
   this->bindVariable("pointWidget", QVariant(QString("ctkCoordinatesWidget")));
   this->bindVariable("unsupportedWidget", QVariant(QString("QLabel")));