ctkCmdLineModuleXmlToQtUi.xsl 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xsl:stylesheet version="2.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  4. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  5. xmlns:fn="http://www.w3.org/2005/xpath-functions"
  6. xmlns:xdt="http://www.w3.org/2005/xpath-datatypes"
  7. xmlns:err="http://www.w3.org/2005/xqt-errors"
  8. xmlns:ctk="http://www.commontk.org"
  9. exclude-result-prefixes="xs xdt err fn">
  10. <xsl:output method="xml" indent="yes"/>
  11. <!--
  12. ===================================================================
  13. Defaults for XSL parameter bindings
  14. ===================================================================
  15. -->
  16. <!--
  17. ########################################################################
  18. **************************** IMPORTANT *****************************
  19. * *
  20. * Please update the documentation in ctkCmdLineModuleFrontendQtGui.h *
  21. * when making changes to (or adding/removing) XSL parameters (names *
  22. * or default values) *
  23. * *
  24. ########################################################################
  25. -->
  26. <xsl:param name="disableReturnParameter">true</xsl:param>
  27. <xsl:param name="executableWidget">QWidget</xsl:param>
  28. <xsl:param name="parametersWidget">ctkCollapsibleGroupBox</xsl:param>
  29. <xsl:param name="booleanWidget">QCheckBox</xsl:param>
  30. <xsl:param name="integerWidget">QSpinBox</xsl:param>
  31. <xsl:param name="floatingWidget">QDoubleSpinBox</xsl:param>
  32. <xsl:param name="vectorWidget">QLineEdit</xsl:param>
  33. <xsl:param name="enumWidget">QComboBox</xsl:param>
  34. <xsl:param name="imageInputWidget">ctkPathLineEdit</xsl:param>
  35. <xsl:param name="imageOutputWidget">ctkPathLineEdit</xsl:param>
  36. <xsl:param name="fileInputWidget">ctkPathLineEdit</xsl:param>
  37. <xsl:param name="fileOutputWidget">ctkPathLineEdit</xsl:param>
  38. <xsl:param name="directoryWidget">ctkPathLineEdit</xsl:param>
  39. <xsl:param name="pointWidget">ctkCoordinatesWidget</xsl:param>
  40. <xsl:param name="unsupportedWidget">QLabel</xsl:param>
  41. <xsl:param name="booleanValueProperty">checked</xsl:param>
  42. <xsl:param name="integerValueProperty">value</xsl:param>
  43. <xsl:param name="floatValueProperty">value</xsl:param>
  44. <xsl:param name="pointValueProperty">coordinates</xsl:param>
  45. <xsl:param name="regionValueProperty">coordinates</xsl:param>
  46. <xsl:param name="imageInputValueProperty">currentPath</xsl:param>
  47. <xsl:param name="imageOutputValueProperty">currentPath</xsl:param>
  48. <xsl:param name="fileInputValueProperty">currentPath</xsl:param>
  49. <xsl:param name="fileOutputValueProperty">currentPath</xsl:param>
  50. <xsl:param name="directoryValueProperty">currentPath</xsl:param>
  51. <xsl:param name="geometryInputValueProperty">currentPath</xsl:param>
  52. <xsl:param name="geometryOutputValueProperty">currentPath</xsl:param>
  53. <xsl:param name="vectorValueProperty">text</xsl:param>
  54. <xsl:param name="enumerationValueProperty">currentEnumeration</xsl:param>
  55. <!--
  56. ===================================================================
  57. Utility XSLT 2.0 functions
  58. ===================================================================
  59. -->
  60. <!-- Map xml parameter element names (types) to the proper QtDesigner UI element. -->
  61. <xsl:function name="ctk:mapTypeToQtDesigner">
  62. <xsl:param name="cliType"/>
  63. <xsl:choose>
  64. <xsl:when test="$cliType='boolean'">bool</xsl:when>
  65. <xsl:when test="$cliType='integer'">number</xsl:when>
  66. <xsl:when test="$cliType='float'">double</xsl:when>
  67. <xsl:when test="$cliType=('point', 'region', 'image', 'file', 'directory', 'geometry', 'integer-vector', 'double-vector', 'float-vector', 'string-vector', 'integer-enumeration', 'double-enumeration', 'float-enumeration', 'string-enumeration')">string</xsl:when>
  68. <xsl:otherwise><xsl:value-of select="$cliType"/></xsl:otherwise>
  69. </xsl:choose>
  70. </xsl:function>
  71. <!-- Map xml parameter element names (types) to the Qt widget property containing
  72. the current value. The property value type should match the (Qt) C++ type
  73. (or be convertible to it). -->
  74. <xsl:function name="ctk:mapTypeToQtValueProperty">
  75. <xsl:param name="cliType"/>
  76. <xsl:param name="cliChannel"/>
  77. <xsl:choose>
  78. <xsl:when test="$cliType='boolean'"><xsl:value-of select="$booleanValueProperty"/></xsl:when>
  79. <xsl:when test="$cliType='integer'"><xsl:value-of select="$integerValueProperty"/></xsl:when>
  80. <xsl:when test="$cliType='float'"><xsl:value-of select="$floatValueProperty"/></xsl:when>
  81. <xsl:when test="$cliType='double'"><xsl:value-of select="$floatValueProperty"/></xsl:when>
  82. <xsl:when test="$cliType='point'"><xsl:value-of select="$pointValueProperty"/></xsl:when>
  83. <xsl:when test="$cliType='region'"><xsl:value-of select="$regionValueProperty"/></xsl:when>
  84. <xsl:when test="$cliType='image' and $cliChannel='input'"><xsl:value-of select="$imageInputValueProperty"/></xsl:when>
  85. <xsl:when test="$cliType='image' and $cliChannel='output'"><xsl:value-of select="$imageOutputValueProperty"/></xsl:when>
  86. <xsl:when test="$cliType='file' and $cliChannel='input'"><xsl:value-of select="$fileInputValueProperty"/></xsl:when>
  87. <xsl:when test="$cliType='file' and $cliChannel='output'"><xsl:value-of select="$fileOutputValueProperty"/></xsl:when>
  88. <xsl:when test="$cliType='directory'"><xsl:value-of select="$directoryValueProperty"/></xsl:when>
  89. <xsl:when test="$cliType='geometry' and $cliChannel='input'"><xsl:value-of select="$geometryInputValueProperty"/></xsl:when>
  90. <xsl:when test="$cliType='geometry' and $cliChannel='output'"><xsl:value-of select="$geometryOutputValueProperty"/></xsl:when>
  91. <xsl:when test="$cliType='integer-vector'"><xsl:value-of select="$vectorValueProperty"/></xsl:when>
  92. <xsl:when test="$cliType='double-vector'"><xsl:value-of select="$vectorValueProperty"/></xsl:when>
  93. <xsl:when test="$cliType='float-vector'"><xsl:value-of select="$vectorValueProperty"/></xsl:when>
  94. <xsl:when test="$cliType='string-vector'"><xsl:value-of select="$vectorValueProperty"/></xsl:when>
  95. <xsl:when test="$cliType='integer-enumeration'"><xsl:value-of select="$enumerationValueProperty"/></xsl:when>
  96. <xsl:when test="$cliType='double-enumeration'"><xsl:value-of select="$enumerationValueProperty"/></xsl:when>
  97. <xsl:when test="$cliType='float-enumeration'"><xsl:value-of select="$enumerationValueProperty"/></xsl:when>
  98. <xsl:when test="$cliType='string-enumeration'"><xsl:value-of select="$enumerationValueProperty"/></xsl:when>
  99. <xsl:otherwise>value</xsl:otherwise>
  100. </xsl:choose>
  101. </xsl:function>
  102. <!--
  103. ===================================================================
  104. Default templates for suppressing output if no more specific template exists
  105. ===================================================================
  106. -->
  107. <!-- suppress text and attribute nodes not covered in subsequent template rule -->
  108. <xsl:template match="text()|@*"/>
  109. <!-- suppress elements not covered in "connections" mode -->
  110. <xsl:template match="*" mode="connections"/>
  111. <!-- suppress elements not covered in "signals" mode -->
  112. <xsl:template match="*" mode="signals"/>
  113. <!--
  114. ===================================================================
  115. Utility templates
  116. ===================================================================
  117. -->
  118. <xsl:template match="parameters/label">
  119. <property name="title">
  120. <string><xsl:value-of select="text()"/></string>
  121. </property>
  122. </xsl:template>
  123. <!-- Add a tooltip property to a widget -->
  124. <xsl:template match="description">
  125. <property name="toolTip">
  126. <string><xsl:value-of select="text()"/></string>
  127. </property>
  128. </xsl:template>
  129. <!-- Set the default value by generating a Qt widget specific property which holds
  130. the current value -->
  131. <xsl:template match="default">
  132. <xsl:choose>
  133. <xsl:when test="../channel">
  134. <xsl:if test="../channel/text()='output'">
  135. <property name="{ctk:mapTypeToQtValueProperty(name(..),'output')}">
  136. <xsl:element name="{ctk:mapTypeToQtDesigner(name(..))}"><xsl:value-of select="text()"/></xsl:element>
  137. </property>
  138. </xsl:if>
  139. <xsl:if test="../channel/text()='input'">
  140. <property name="{ctk:mapTypeToQtValueProperty(name(..),'input')}">
  141. <xsl:element name="{ctk:mapTypeToQtDesigner(name(..))}"><xsl:value-of select="text()"/></xsl:element>
  142. </property>
  143. </xsl:if>
  144. </xsl:when>
  145. <xsl:otherwise>
  146. <property name="{ctk:mapTypeToQtValueProperty(name(..),'dummy')}">
  147. <xsl:element name="{ctk:mapTypeToQtDesigner(name(..))}"><xsl:value-of select="text()"/></xsl:element>
  148. </property>
  149. </xsl:otherwise>
  150. </xsl:choose>
  151. </xsl:template>
  152. <!-- Set Qt widget (spinbox) specific properties for applying constraints of scalar parameters -->
  153. <xsl:template match="constraints/*[name()=('minimum','maximum')]">
  154. <property name="{name()}">
  155. <xsl:element name="{ctk:mapTypeToQtDesigner(name(../..))}"><xsl:value-of select="text()"/></xsl:element>
  156. </property>
  157. </xsl:template>
  158. <xsl:template match="constraints/step">
  159. <property name="singleStep">
  160. <xsl:element name="{ctk:mapTypeToQtDesigner(name(../..))}"><xsl:value-of select="text()"/></xsl:element>
  161. </property>
  162. </xsl:template>
  163. <!-- A named template which will be called from each parameter (integer, float, image, etc.) element.
  164. It assumes that it will be called from an enclosing Qt grid layout element and adds a label item -->
  165. <xsl:template name="gridItemWithLabel">
  166. <item row="{position()-1}" column="0">
  167. <widget class="QLabel">
  168. <property name="sizePolicy">
  169. <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
  170. <horstretch>0</horstretch>
  171. <verstretch>0</verstretch>
  172. </sizepolicy>
  173. </property>
  174. <property name="text">
  175. <string><xsl:value-of select="./label"/></string>
  176. </property>
  177. </widget>
  178. </item>
  179. </xsl:template>
  180. <!-- A named template for adding properties common to all Qt widgets -->
  181. <xsl:template name="commonWidgetProperties">
  182. <xsl:apply-templates select="description"/> <!-- tooltip -->
  183. <xsl:if test="@hidden='true'"> <!-- widget visibility -->
  184. <property name="visible">
  185. <bool>false</bool>
  186. </property>
  187. </xsl:if>
  188. <!-- disable simple return parameter -->
  189. <xsl:if test="index/text()='1000' and channel/text()='output' and $disableReturnParameter='true'">
  190. <property name="enabled">
  191. <bool>false</bool>
  192. </property>
  193. </xsl:if>
  194. <property name="parameter:valueProperty"> <!-- property name containing current value -->
  195. <xsl:choose>
  196. <xsl:when test="channel">
  197. <xsl:if test="channel/text()='output'">
  198. <string><xsl:value-of select="ctk:mapTypeToQtValueProperty(name(),'output')"/></string>
  199. </xsl:if>
  200. <xsl:if test="channel/text()='input'">
  201. <string><xsl:value-of select="ctk:mapTypeToQtValueProperty(name(),'input')"/></string>
  202. </xsl:if>
  203. </xsl:when>
  204. <xsl:otherwise>
  205. <string><xsl:value-of select="ctk:mapTypeToQtValueProperty(name(),'dummy')"/></string>
  206. </xsl:otherwise>
  207. </xsl:choose>
  208. </property>
  209. <!-- add additional (optional) information as properties -->
  210. <xsl:apply-templates select="default"/>
  211. <xsl:apply-templates select="constraints"/>
  212. </xsl:template>
  213. <!-- A named template for creating a QtDesigner stringlist property -->
  214. <xsl:template name="createQtDesignerStringListProperty">
  215. <property name="nameFilters">
  216. <stringlist>
  217. <xsl:for-each select="tokenize(@fileExtensions, ',')">
  218. <string><xsl:value-of select="normalize-space(.)"/></string>
  219. </xsl:for-each>
  220. </stringlist>
  221. </property>
  222. </xsl:template>
  223. <!--
  224. ===================================================================
  225. Match elements from the XML description
  226. ===================================================================
  227. -->
  228. <!-- start matching at 'executable' element -->
  229. <xsl:template match="/executable">
  230. <xsl:variable name="moduleTitle"><xsl:value-of select="title"/></xsl:variable>
  231. <ui version="4.0" >
  232. <class><xsl:value-of select="translate(normalize-space($moduleTitle), ' ', '')"/></class>
  233. <widget class="{$executableWidget}" name="executable:{normalize-space($moduleTitle)}">
  234. <layout class="QVBoxLayout">
  235. <!-- This will generate QGroupBox items with the specific widgets -->
  236. <xsl:apply-templates select="parameters"/>
  237. <!-- Add a spacer at the bottom -->
  238. <item>
  239. <spacer name="verticalSpacer">
  240. <property name="orientation">
  241. <enum>Qt::Vertical</enum>
  242. </property>
  243. </spacer>
  244. </item>
  245. </layout>
  246. </widget>
  247. <connections>
  248. <xsl:apply-templates mode="connections" select="parameters/*"/>
  249. </connections>
  250. </ui>
  251. </xsl:template>
  252. <!--
  253. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  254. Parameters (default: ctkCollapsibleGroupBox)
  255. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  256. -->
  257. <!-- Match the 'parameters' element and create the parameter groups (QGroupBox) -->
  258. <xsl:template match="parameters">
  259. <xsl:variable name="groupLabel"><xsl:value-of select="label"/></xsl:variable>
  260. <item>
  261. <widget class="{$parametersWidget}" name="paramGroup:{$groupLabel}">
  262. <xsl:apply-templates select="./label"/>
  263. <xsl:apply-templates select="./description"/>
  264. <property name="checked">
  265. <xsl:choose>
  266. <xsl:when test="@advanced = 'true'">
  267. <bool>false</bool>
  268. </xsl:when>
  269. <xsl:otherwise>
  270. <bool>true</bool>
  271. </xsl:otherwise>
  272. </xsl:choose>
  273. </property>
  274. <layout class="QVBoxLayout" name="paramContainerLayout:{$groupLabel}">
  275. <item>
  276. <widget class="QWidget" name="paramContainer:{$groupLabel}">
  277. <layout class="QGridLayout">
  278. <xsl:apply-templates select="./description/following-sibling::*"/>
  279. </layout>
  280. </widget>
  281. </item>
  282. </layout>
  283. </widget>
  284. </item>
  285. </xsl:template>
  286. <!--
  287. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  288. BOOLEAN parameter (default: QCheckbox)
  289. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  290. -->
  291. <xsl:template match="parameters/boolean">
  292. <xsl:call-template name="gridItemWithLabel"/>
  293. <item row="{position()-1}" column="1">
  294. <widget class="{$booleanWidget}" name="parameter:{name}">
  295. <xsl:call-template name="commonWidgetProperties"/>
  296. <property name="text">
  297. <string/>
  298. </property>
  299. </widget>
  300. </item>
  301. </xsl:template>
  302. <!--
  303. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  304. INTEGER parameter (default: QSpinBox)
  305. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  306. -->
  307. <xsl:template match="parameters/integer">
  308. <xsl:call-template name="gridItemWithLabel"/>
  309. <item row="{position()-1}" column="1">
  310. <widget class="{$integerWidget}" name="parameter:{name}">
  311. <xsl:if test="not(constraints)">
  312. <property name="minimum">
  313. <number>-999999999</number>
  314. </property>
  315. <property name="maximum">
  316. <number>999999999</number>
  317. </property>
  318. </xsl:if>
  319. <xsl:call-template name="commonWidgetProperties"/>
  320. </widget>
  321. </item>
  322. </xsl:template>
  323. <!--
  324. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  325. DOUBLE, FLOAT parameter (default: QDoubleSpinBox)
  326. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  327. -->
  328. <xsl:template match="parameters/*[name()=('double','float')]">
  329. <xsl:call-template name="gridItemWithLabel"/>
  330. <item row="{position()-1}" column="1">
  331. <widget class="{$floatingWidget}" name="parameter:{name}">
  332. <property name="decimals">
  333. <number>6</number>
  334. </property>
  335. <xsl:if test="not(constraints)">
  336. <property name="minimum">
  337. <double>-999999999</double>
  338. </property>
  339. <property name="maximum">
  340. <double>999999999</double>
  341. </property>
  342. </xsl:if>
  343. <xsl:call-template name="commonWidgetProperties"/>
  344. </widget>
  345. </item>
  346. </xsl:template>
  347. <!--
  348. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  349. STRING, INTEGER-VECTOR, DOUBLE-VECTOR, FLOAT-VECTOR, STRING-VECTOR parameter (default: QLineEdit)
  350. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  351. -->
  352. <xsl:template match="parameters/*[name()=('string', 'integer-vector', 'float-vector', 'double-vector', 'string-vector')]">
  353. <xsl:call-template name="gridItemWithLabel"/>
  354. <item row="{position()-1}" column="1">
  355. <widget class="{$vectorWidget}" name="parameter:{name}">
  356. <xsl:call-template name="commonWidgetProperties"/>
  357. </widget>
  358. </item>
  359. </xsl:template>
  360. <!--
  361. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  362. INTEGER-ENUMERATION, DOUBLE-ENUMERATION, FLOAT-ENUMERATION, STRING-ENUMERATION parameter (default: QComboBox)
  363. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  364. -->
  365. <xsl:template match="parameters/*[name()=('integer-enumeration', 'float-enumeration', 'double-enumeration', 'string-enumeration')]">
  366. <xsl:call-template name="gridItemWithLabel"/>
  367. <item row="{position()-1}" column="1">
  368. <widget class="{$enumWidget}" name="parameter:{name}">
  369. <xsl:call-template name="commonWidgetProperties"/>
  370. <xsl:for-each select="element">
  371. <item>
  372. <property name="text">
  373. <string><xsl:value-of select="text()"/></string>
  374. </property>
  375. </item>
  376. </xsl:for-each>
  377. </widget>
  378. </item>
  379. </xsl:template>
  380. <!--
  381. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  382. IMAGE parameter (default: ctkPathLineEdit)
  383. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  384. -->
  385. <xsl:template match="parameters/*[name()=('image')]">
  386. <xsl:call-template name="gridItemWithLabel"/>
  387. <item row="{position()-1}" column="1">
  388. <xsl:choose>
  389. <xsl:when test="channel = 'input'">
  390. <widget class="{$imageInputWidget}" name="parameter:{name}">
  391. <xsl:call-template name="commonWidgetProperties"/>
  392. <xsl:call-template name="createQtDesignerStringListProperty"/>
  393. <property name="filters">
  394. <set>ctkPathLineEdit::Files,ctkPathLineEdit::Readable</set>
  395. </property>
  396. </widget>
  397. </xsl:when>
  398. <xsl:otherwise>
  399. <widget class="{$imageOutputWidget}" name="parameter:{name}">
  400. <xsl:call-template name="commonWidgetProperties"/>
  401. <xsl:call-template name="createQtDesignerStringListProperty"/>
  402. <property name="filters">
  403. <set>ctkPathLineEdit::Files,ctkPathLineEdit::Writable</set>
  404. </property>
  405. </widget>
  406. </xsl:otherwise>
  407. </xsl:choose>
  408. </item>
  409. </xsl:template>
  410. <!--
  411. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  412. FILE, GEOMETRY parameter (default: ctkPathLineEdit)
  413. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  414. -->
  415. <xsl:template match="parameters/*[name()=('file', 'geometry')]">
  416. <xsl:call-template name="gridItemWithLabel"/>
  417. <item row="{position()-1}" column="1">
  418. <xsl:choose>
  419. <xsl:when test="channel = 'input'">
  420. <widget class="{$fileInputWidget}" name="parameter:{name}">
  421. <xsl:call-template name="commonWidgetProperties"/>
  422. <xsl:call-template name="createQtDesignerStringListProperty"/>
  423. <property name="filters">
  424. <set>ctkPathLineEdit::Files,ctkPathLineEdit::Readable</set>
  425. </property>
  426. </widget>
  427. </xsl:when>
  428. <xsl:otherwise>
  429. <widget class="{$fileOutputWidget}" name="parameter:{name}">
  430. <xsl:call-template name="commonWidgetProperties"/>
  431. <xsl:call-template name="createQtDesignerStringListProperty"/>
  432. <property name="filters">
  433. <set>ctkPathLineEdit::Files,ctkPathLineEdit::Writable</set>
  434. </property>
  435. </widget>
  436. </xsl:otherwise>
  437. </xsl:choose>
  438. </item>
  439. </xsl:template>
  440. <!--
  441. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  442. DIRECTORY parameter (default: ctkPathLineEdit)
  443. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  444. -->
  445. <xsl:template match="parameters/directory">
  446. <xsl:call-template name="gridItemWithLabel"/>
  447. <item row="{position()-1}" column="1">
  448. <widget class="{$directoryWidget}" name="parameter:{name}">
  449. <xsl:call-template name="commonWidgetProperties"/>
  450. <property name="filters">
  451. <set>ctkPathLineEdit::Dirs</set>
  452. </property>
  453. </widget>
  454. </item>
  455. </xsl:template>
  456. <!--
  457. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  458. POINT, REGION parameter (default: ctkCoordinatesWidget)
  459. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  460. -->
  461. <xsl:template match="parameters/*[name()=('point', 'region')]">
  462. <xsl:call-template name="gridItemWithLabel"/>
  463. <item row="{position()-1}" column="1">
  464. <widget class="{$pointWidget}" name="parameter:{name}">
  465. <xsl:call-template name="commonWidgetProperties"/>
  466. </widget>
  467. </item>
  468. </xsl:template>
  469. <!--
  470. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  471. NOT IMPLEMENTED YET
  472. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  473. -->
  474. <xsl:template match="parameters/*" priority="-1">
  475. <xsl:call-template name="gridItemWithLabel"/>
  476. <item row="{position()-1}" column="1">
  477. <widget class="{$unsupportedWidget}" name="{name}">
  478. <property name="text">
  479. <string>&lt;html&gt;&lt;head&gt;&lt;meta name="qrichtext" content="1" /&gt;&lt;style type="text/css"&gt;p, li { white-space: pre-wrap; }&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;p style="margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"&gt;&lt;span style=" color:#ff0000;">Element '<xsl:value-of select="name()"/>' not supported yet.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
  480. </property>
  481. <property name="textFormat">
  482. <enum>Qt::RichText</enum>
  483. </property>
  484. </widget>
  485. </item>
  486. </xsl:template>
  487. <!-- EXTRA TRANSFORMATIONS -->
  488. </xsl:stylesheet>