WorkspaceSummaryDialog.qml 11 KB

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