WorkspaceSummaryDialog.qml 11 KB

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