WorkspaceSummaryDialog.qml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293
  1. // Copyright (c) 2022 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.10
  4. import QtQuick.Controls 2.9
  5. import QtQuick.Layouts 1.3
  6. import UM 1.5 as UM
  7. import Cura 1.0 as Cura
  8. UM.Dialog
  9. {
  10. id: base
  11. title: catalog.i18nc("@title:window", "Save Project")
  12. minimumWidth: UM.Theme.getSize("popup_dialog").width
  13. minimumHeight: UM.Theme.getSize("popup_dialog").height
  14. width: minimumWidth
  15. height: minimumHeight
  16. property bool dontShowAgain: true
  17. onClosing: UM.Preferences.setValue("cura/dialog_on_project_save", !dontShowAgainCheckbox.checked)
  18. onVisibleChanged:
  19. {
  20. if(visible)
  21. {
  22. dontShowAgain = !UM.Preferences.getValue("cura/dialog_on_project_save")
  23. }
  24. }
  25. Item
  26. {
  27. anchors.fill: parent
  28. UM.SettingDefinitionsModel
  29. {
  30. id: definitionsModel
  31. containerId: base.visible ? Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" : ""
  32. showAll: true
  33. exclude: ["command_line_settings"]
  34. showAncestors: true
  35. expanded: ["*"]
  36. visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
  37. }
  38. UM.Label
  39. {
  40. id: mainHeading
  41. width: parent.width
  42. text: catalog.i18nc("@action:title", "Summary - Cura Project")
  43. font.pointSize: 18
  44. anchors.top: parent.top
  45. }
  46. ScrollView
  47. {
  48. id: scroll
  49. width: parent.width
  50. anchors
  51. {
  52. top: mainHeading.bottom
  53. topMargin: UM.Theme.getSize("default_margin").height
  54. bottom: parent.bottom
  55. bottomMargin: UM.Theme.getSize("default_margin").height
  56. }
  57. ScrollBar.vertical: UM.ScrollBar
  58. {
  59. parent: scroll.parent
  60. anchors
  61. {
  62. top: parent.top
  63. right: parent.right
  64. bottom: parent.bottom
  65. }
  66. }
  67. clip: true
  68. ColumnLayout
  69. {
  70. spacing: UM.Theme.getSize("default_margin").height
  71. Column
  72. {
  73. UM.Label
  74. {
  75. id: settingsHeading
  76. text: catalog.i18nc("@action:label", "Printer settings")
  77. font.bold: true
  78. }
  79. Row
  80. {
  81. width: parent.width
  82. height: childrenRect.height
  83. UM.Label
  84. {
  85. text: catalog.i18nc("@action:label", "Type")
  86. width: Math.floor(scroll.width / 3) | 0
  87. }
  88. UM.Label
  89. {
  90. text: Cura.MachineManager.activeMachine == null ? "" : Cura.MachineManager.activeMachine.definition.name
  91. width: Math.floor(scroll.width / 3) | 0
  92. }
  93. }
  94. Row
  95. {
  96. width: parent.width
  97. height: childrenRect.height
  98. UM.Label
  99. {
  100. text: Cura.MachineManager.activeMachineNetworkGroupName != "" ? catalog.i18nc("@action:label", "Printer Group") : catalog.i18nc("@action:label", "Name")
  101. width: Math.floor(scroll.width / 3) | 0
  102. }
  103. UM.Label
  104. {
  105. text:
  106. {
  107. if(Cura.MachineManager.activeMachineNetworkGroupName != "")
  108. {
  109. return Cura.MachineManager.activeMachineNetworkGroupName
  110. }
  111. if(Cura.MachineManager.activeMachine)
  112. {
  113. return Cura.MachineManager.activeMachine.name
  114. }
  115. return ""
  116. }
  117. width: Math.floor(scroll.width / 3) | 0
  118. }
  119. }
  120. }
  121. Repeater
  122. {
  123. width: parent.width
  124. height: childrenRect.height
  125. model: Cura.MachineManager.activeMachine ? Cura.MachineManager.activeMachine.extruderList : null
  126. delegate: Column
  127. {
  128. height: childrenRect.height
  129. width: parent.width
  130. property string variantName:
  131. {
  132. var extruder = modelData
  133. var variant_name = extruder.variant.name
  134. return (variant_name !== undefined) ? variant_name : ""
  135. }
  136. property string materialName:
  137. {
  138. var extruder = modelData
  139. var material_name = extruder.material.name
  140. return (material_name !== undefined) ? material_name : ""
  141. }
  142. UM.Label
  143. {
  144. text: {
  145. var extruder = Number(modelData.position)
  146. var extruder_id = ""
  147. if(!isNaN(extruder))
  148. {
  149. extruder_id = extruder + 1 // The extruder counter start from One and not Zero
  150. }
  151. else
  152. {
  153. extruder_id = modelData.position
  154. }
  155. return catalog.i18nc("@action:label", "Extruder %1").arg(extruder_id)
  156. }
  157. font.bold: true
  158. enabled: modelData.isEnabled
  159. }
  160. Row
  161. {
  162. width: parent.width
  163. height: childrenRect.height
  164. UM.Label
  165. {
  166. text:
  167. {
  168. if(variantName !== "" && materialName !== "")
  169. {
  170. return catalog.i18nc("@action:label", "%1 & material").arg(Cura.MachineManager.activeDefinitionVariantsName)
  171. }
  172. return catalog.i18nc("@action:label", "Material")
  173. }
  174. width: Math.floor(scroll.width / 3) | 0
  175. enabled: modelData.isEnabled
  176. }
  177. UM.Label
  178. {
  179. text:
  180. {
  181. if(variantName !== "" && materialName !== "")
  182. {
  183. return variantName + ", " + materialName
  184. }
  185. return materialName
  186. }
  187. enabled: modelData.isEnabled
  188. width: Math.floor(scroll.width / 3) | 0
  189. }
  190. }
  191. }
  192. }
  193. Column
  194. {
  195. width: parent.width
  196. height: childrenRect.height
  197. UM.Label
  198. {
  199. text: catalog.i18nc("@action:label", "Profile settings")
  200. font.bold: true
  201. }
  202. Row
  203. {
  204. width: parent.width
  205. UM.Label
  206. {
  207. text: catalog.i18nc("@action:label", "Not in profile")
  208. width: Math.floor(scroll.width / 3) | 0
  209. }
  210. UM.Label
  211. {
  212. text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", Cura.MachineManager.numUserSettings).arg(Cura.MachineManager.numUserSettings)
  213. width: Math.floor(scroll.width / 3) | 0
  214. }
  215. visible: Cura.MachineManager.numUserSettings
  216. }
  217. Row
  218. {
  219. width: parent.width
  220. height: childrenRect.height
  221. UM.Label
  222. {
  223. text: catalog.i18nc("@action:label", "Name")
  224. width: Math.floor(scroll.width / 3) | 0
  225. }
  226. UM.Label
  227. {
  228. text: Cura.MachineManager.activeQualityOrQualityChangesName
  229. width: Math.floor(scroll.width / 3) | 0
  230. }
  231. }
  232. // Intent
  233. Row
  234. {
  235. width: parent.width
  236. height: childrenRect.height
  237. UM.Label
  238. {
  239. text: catalog.i18nc("@action:label", "Intent")
  240. width: Math.floor(scroll.width / 3) | 0
  241. }
  242. UM.Label
  243. {
  244. text: Cura.MachineManager.activeIntentCategory
  245. width: Math.floor(scroll.width / 3) | 0
  246. }
  247. }
  248. }
  249. }
  250. }
  251. }
  252. buttonSpacing: UM.Theme.getSize("thin_margin").width
  253. leftButtons:
  254. [
  255. UM.CheckBox
  256. {
  257. id: dontShowAgainCheckbox
  258. text: catalog.i18nc("@action:label", "Don't show project summary on save again")
  259. checked: dontShowAgain
  260. }
  261. ]
  262. rightButtons:
  263. [
  264. Cura.SecondaryButton
  265. {
  266. text: catalog.i18nc("@action:button", "Cancel")
  267. onClicked: base.reject()
  268. },
  269. Cura.PrimaryButton
  270. {
  271. text: catalog.i18nc("@action:button", "Save")
  272. onClicked: base.accept()
  273. }
  274. ]
  275. }