WorkspaceSummaryDialog.qml 11 KB

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