WorkspaceSummaryDialog.qml 11 KB

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