WorkspaceSummaryDialog.qml 11 KB

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