WorkspaceSummaryDialog.qml 11 KB

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