ConfigUI.qml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.15
  4. import QtQuick.Controls 2.15
  5. import QtQuick.Layouts 1.3
  6. import QtQuick.Window 2.1
  7. import UM 1.5 as UM
  8. import Cura 1.0 as Cura
  9. UM.Dialog
  10. {
  11. title: catalog.i18nc("@title:window", "Convert Image")
  12. minimumWidth: grid.width + 2 * UM.Theme.getSize("default_margin").height
  13. minimumHeight: UM.Theme.getSize("modal_window_minimum").height
  14. width: minimumWidth
  15. height: minimumHeight
  16. GridLayout
  17. {
  18. UM.I18nCatalog { id: catalog; name: "cura" }
  19. id: grid
  20. columnSpacing: UM.Theme.getSize("narrow_margin").width
  21. rowSpacing: UM.Theme.getSize("narrow_margin").height
  22. columns: 2
  23. UM.Label
  24. {
  25. Layout.fillWidth: true
  26. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  27. text: catalog.i18nc("@action:label", "Height (mm)")
  28. Layout.alignment: Qt.AlignVCenter
  29. MouseArea {
  30. id: peak_height_label
  31. anchors.fill: parent
  32. hoverEnabled: true
  33. }
  34. }
  35. Cura.TextField
  36. {
  37. id: peak_height
  38. Layout.fillWidth: true
  39. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  40. selectByMouse: true
  41. objectName: "Peak_Height"
  42. validator: RegularExpressionValidator { regularExpression: /^\d{0,3}([\,|\.]\d*)?$/ }
  43. onTextChanged: manager.onPeakHeightChanged(text)
  44. }
  45. UM.ToolTip
  46. {
  47. text: catalog.i18nc("@info:tooltip", "The maximum distance of each pixel from \"Base.\"")
  48. visible: peak_height.hovered || peak_height_label.containsMouse
  49. targetPoint: Qt.point(peak_height.x + Math.round(peak_height.width / 2), 0)
  50. y: peak_height.y + peak_height.height + UM.Theme.getSize("default_margin").height
  51. }
  52. UM.Label
  53. {
  54. Layout.fillWidth: true
  55. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  56. text: catalog.i18nc("@action:label", "Base (mm)")
  57. Layout.alignment: Qt.AlignVCenter
  58. MouseArea
  59. {
  60. id: base_height_label
  61. anchors.fill: parent
  62. hoverEnabled: true
  63. }
  64. }
  65. Cura.TextField
  66. {
  67. id: base_height
  68. selectByMouse: true
  69. Layout.fillWidth: true
  70. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  71. objectName: "Base_Height"
  72. validator: RegularExpressionValidator { regularExpression: /^\d{0,3}([\,|\.]\d*)?$/ }
  73. onTextChanged: manager.onBaseHeightChanged(text)
  74. }
  75. UM.ToolTip
  76. {
  77. text: catalog.i18nc("@info:tooltip", "The base height from the build plate in millimeters.")
  78. visible: base_height.hovered || base_height_label.containsMouse
  79. targetPoint: Qt.point(base_height.x + Math.round(base_height.width / 2), 0)
  80. y: base_height.y + base_height.height + UM.Theme.getSize("default_margin").height
  81. }
  82. UM.Label
  83. {
  84. Layout.fillWidth: true
  85. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  86. text: catalog.i18nc("@action:label", "Width (mm)")
  87. Layout.alignment: Qt.AlignVCenter
  88. MouseArea {
  89. id: width_label
  90. anchors.fill: parent
  91. hoverEnabled: true
  92. }
  93. }
  94. Cura.TextField
  95. {
  96. id: width
  97. selectByMouse: true
  98. objectName: "Width"
  99. Layout.fillWidth: true
  100. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  101. focus: true
  102. validator: RegularExpressionValidator { regularExpression: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
  103. onTextChanged: manager.onWidthChanged(text)
  104. }
  105. UM.ToolTip
  106. {
  107. text: catalog.i18nc("@info:tooltip", "The width in millimeters on the build plate")
  108. visible: width.hovered || width_label.containsMouse
  109. targetPoint: Qt.point(width.x + Math.round(width.width / 2), 0)
  110. y: width.y + width.height + UM.Theme.getSize("default_margin").height
  111. }
  112. UM.Label
  113. {
  114. Layout.fillWidth: true
  115. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  116. text: catalog.i18nc("@action:label", "Depth (mm)")
  117. Layout.alignment: Qt.AlignVCenter
  118. MouseArea {
  119. id: depth_label
  120. anchors.fill: parent
  121. hoverEnabled: true
  122. }
  123. }
  124. Cura.TextField
  125. {
  126. id: depth
  127. Layout.fillWidth: true
  128. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  129. selectByMouse: true
  130. objectName: "Depth"
  131. focus: true
  132. validator: RegularExpressionValidator { regularExpression: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
  133. onTextChanged: manager.onDepthChanged(text)
  134. }
  135. UM.ToolTip
  136. {
  137. text: catalog.i18nc("@info:tooltip", "The depth in millimeters on the build plate")
  138. visible: depth.hovered || depth_label.containsMouse
  139. targetPoint: Qt.point(depth.x + Math.round(depth.width / 2), 0)
  140. y: depth.y + depth.height + UM.Theme.getSize("default_margin").height
  141. }
  142. UM.Label
  143. {
  144. Layout.fillWidth: true
  145. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  146. text: ""
  147. Layout.alignment: Qt.AlignVCenter
  148. MouseArea {
  149. id: lighter_is_higher_label
  150. anchors.fill: parent
  151. hoverEnabled: true
  152. }
  153. }
  154. Cura.ComboBox
  155. {
  156. id: lighter_is_higher
  157. Layout.fillWidth: true
  158. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  159. Layout.preferredHeight: UM.Theme.getSize("setting_control").height
  160. objectName: "Lighter_Is_Higher"
  161. textRole: "text"
  162. model: [
  163. { text: catalog.i18nc("@item:inlistbox", "Darker is higher") },
  164. { text: catalog.i18nc("@item:inlistbox", "Lighter is higher") }
  165. ]
  166. onCurrentIndexChanged: { manager.onImageColorInvertChanged(currentIndex) }
  167. }
  168. UM.ToolTip
  169. {
  170. text: catalog.i18nc("@info:tooltip", "For lithophanes dark pixels should correspond to thicker locations in order to block more light coming through. For height maps lighter pixels signify higher terrain, so lighter pixels should correspond to thicker locations in the generated 3D model.")
  171. visible: lighter_is_higher.hovered || lighter_is_higher_label.containsMouse
  172. targetPoint: Qt.point(lighter_is_higher.x + Math.round(lighter_is_higher.width / 2), 0)
  173. y: lighter_is_higher.y + lighter_is_higher.height + UM.Theme.getSize("default_margin").height
  174. }
  175. UM.Label
  176. {
  177. Layout.fillWidth: true
  178. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  179. text: catalog.i18nc("@action:label", "Color Model")
  180. Layout.alignment: Qt.AlignVCenter
  181. MouseArea {
  182. id: color_model_label
  183. anchors.fill: parent
  184. hoverEnabled: true
  185. }
  186. }
  187. Cura.ComboBox
  188. {
  189. id: color_model
  190. Layout.fillWidth: true
  191. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  192. Layout.preferredHeight: UM.Theme.getSize("setting_control").height
  193. objectName: "ColorModel"
  194. textRole: "text"
  195. model: [
  196. { text: catalog.i18nc("@item:inlistbox", "Linear") },
  197. { text: catalog.i18nc("@item:inlistbox", "Translucency") }
  198. ]
  199. onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
  200. }
  201. UM.ToolTip
  202. {
  203. text: catalog.i18nc("@info:tooltip", "For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.")
  204. visible: color_model.hovered || color_model_label.containsMouse
  205. targetPoint: Qt.point(color_model.x + Math.round(color_model.width / 2), 0)
  206. y: color_model.y + color_model.height + UM.Theme.getSize("default_margin").height
  207. }
  208. UM.Label
  209. {
  210. Layout.fillWidth: true
  211. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  212. text: catalog.i18nc("@action:label", "1mm Transmittance (%)")
  213. Layout.alignment: Qt.AlignVCenter
  214. MouseArea {
  215. id: transmittance_label
  216. anchors.fill: parent
  217. hoverEnabled: true
  218. }
  219. }
  220. Cura.TextField
  221. {
  222. Layout.fillWidth: true
  223. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  224. selectByMouse: true
  225. objectName: "Transmittance"
  226. validator: RegularExpressionValidator { regularExpression: /^[1-9]\d{0,2}([\,|\.]\d*)?$/ }
  227. onTextChanged: manager.onTransmittanceChanged(text)
  228. UM.ToolTip
  229. {
  230. text: catalog.i18nc("@info:tooltip", "The percentage of light penetrating a print with a thickness of 1 millimeter. Lowering this value increases the contrast in dark regions and decreases the contrast in light regions of the image.")
  231. visible: parent.hovered || transmittance_label.containsMouse
  232. targetPoint: Qt.point(parent.x + Math.round(parent.width / 2), 0)
  233. y: parent.y + parent.height + UM.Theme.getSize("default_margin").height
  234. }
  235. }
  236. UM.Label
  237. {
  238. Layout.fillWidth: true
  239. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  240. text: catalog.i18nc("@action:label", "Smoothing")
  241. Layout.alignment: Qt.AlignVCenter
  242. MouseArea
  243. {
  244. id: smoothing_label
  245. anchors.fill: parent
  246. hoverEnabled: true
  247. }
  248. }
  249. Cura.SpinBox
  250. {
  251. id: smoothing
  252. Layout.fillWidth: true
  253. Layout.minimumWidth: UM.Theme.getSize("setting_control").width
  254. objectName: "Smoothing"
  255. to: 100.0
  256. stepSize: 1.0
  257. onValueChanged: manager.onSmoothingChanged(value)
  258. }
  259. UM.ToolTip
  260. {
  261. text: catalog.i18nc("@info:tooltip", "The amount of smoothing to apply to the image.")
  262. visible: smoothing.hovered || smoothing_label.containsMouse
  263. targetPoint: Qt.point(smoothing.x + Math.round(smoothing.width / 2), 0)
  264. y: smoothing.y + smoothing.height + UM.Theme.getSize("default_margin").height
  265. }
  266. }
  267. Item
  268. {
  269. ButtonGroup
  270. {
  271. buttons: [ok_button, cancel_button]
  272. checkedButton: ok_button
  273. }
  274. }
  275. onAccepted: manager.onOkButtonClicked()
  276. onRejected: manager.onCancelButtonClicked()
  277. buttonSpacing: UM.Theme.getSize("default_margin").width
  278. rightButtons: [
  279. Cura.TertiaryButton
  280. {
  281. id: cancel_button
  282. text: catalog.i18nc("@action:button", "Cancel")
  283. onClicked: manager.onCancelButtonClicked()
  284. },
  285. Cura.PrimaryButton
  286. {
  287. id: ok_button
  288. text: catalog.i18nc("@action:button", "OK")
  289. onClicked: manager.onOkButtonClicked()
  290. }
  291. ]
  292. }