WorkspaceSummaryDialog.qml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.1
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Layouts 1.1
  6. import QtQuick.Window 2.1
  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.activeDefinitionId: ""
  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: Cura.MachineManager.activeMachineNetworkGroupName != "" ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
  115. width: Math.floor(scroll.width / 3) | 0
  116. }
  117. }
  118. }
  119. Row
  120. {
  121. visible: Cura.MachineManager.hasVariantBuildplates
  122. width: parent.width
  123. height: childrenRect.height
  124. Label
  125. {
  126. text: catalog.i18nc("@action:label", "Build plate")
  127. width: Math.floor(scroll.width / 3) | 0
  128. }
  129. Label
  130. {
  131. text: Cura.MachineManager.activeVariantBuildplateName
  132. width: Math.floor(scroll.width / 3) | 0
  133. }
  134. }
  135. Repeater
  136. {
  137. width: parent.width
  138. height: childrenRect.height
  139. model: Cura.MachineManager.currentExtruderPositions
  140. delegate: Column
  141. {
  142. height: childrenRect.height
  143. width: parent.width
  144. Label
  145. {
  146. text: {
  147. var extruder = Number(modelData)
  148. var extruder_id = ""
  149. if(!isNaN(extruder))
  150. {
  151. extruder_id = extruder + 1 // The extruder counter start from One and not Zero
  152. }
  153. else
  154. {
  155. extruder_id = modelData
  156. }
  157. return catalog.i18nc("@action:label", "Extruder %1").arg(extruder_id)
  158. }
  159. font.bold: true
  160. }
  161. Row
  162. {
  163. width: parent.width
  164. height: childrenRect.height
  165. Label
  166. {
  167. text: catalog.i18nc("@action:label", "%1 & material").arg(Cura.MachineManager.activeDefinitionVariantsName)
  168. width: Math.floor(scroll.width / 3) | 0
  169. }
  170. Label
  171. {
  172. text: Cura.MachineManager.activeVariantNames[modelData] + ", " + Cura.MachineManager.getExtruder(modelData).material.name
  173. width: Math.floor(scroll.width / 3) | 0
  174. }
  175. }
  176. }
  177. }
  178. Column
  179. {
  180. width: parent.width
  181. height: childrenRect.height
  182. Label
  183. {
  184. text: catalog.i18nc("@action:label", "Profile settings")
  185. font.bold: true
  186. }
  187. Row
  188. {
  189. width: parent.width
  190. Label
  191. {
  192. text: catalog.i18nc("@action:label", "Not in profile")
  193. width: Math.floor(scroll.width / 3) | 0
  194. }
  195. Label
  196. {
  197. text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", Cura.MachineManager.numUserSettings).arg(Cura.MachineManager.numUserSettings)
  198. width: Math.floor(scroll.width / 3) | 0
  199. }
  200. visible: Cura.MachineManager.numUserSettings
  201. }
  202. Row
  203. {
  204. width: parent.width
  205. height: childrenRect.height
  206. Label
  207. {
  208. text: catalog.i18nc("@action:label", "Name")
  209. width: Math.floor(scroll.width / 3) | 0
  210. }
  211. Label
  212. {
  213. text: Cura.MachineManager.activeQualityOrQualityChangesName
  214. width: Math.floor(scroll.width / 3) | 0
  215. }
  216. }
  217. }
  218. Column
  219. {
  220. width: parent.width
  221. height: childrenRect.height
  222. Label
  223. {
  224. text: catalog.i18nc("@action:label", "Setting visibility")
  225. font.bold: true
  226. }
  227. Row
  228. {
  229. width: parent.width
  230. height: childrenRect.height
  231. Label
  232. {
  233. text: catalog.i18nc("@action:label", "Visible settings:")
  234. width: Math.floor(scroll.width / 3) | 0
  235. }
  236. Label
  237. {
  238. text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(definitionsModel.visibleCount).arg(Cura.MachineManager.totalNumberOfSettings)
  239. width: Math.floor(scroll.width / 3) | 0
  240. }
  241. }
  242. }
  243. }
  244. }
  245. Item
  246. {
  247. id: controls
  248. width: parent.width
  249. height: childrenRect.height
  250. anchors.bottom: parent.bottom
  251. CheckBox
  252. {
  253. id: dontShowAgainCheckbox
  254. anchors.left: parent.left
  255. text: catalog.i18nc("@action:label", "Don't show project summary on save again")
  256. checked: dontShowAgain
  257. }
  258. Button
  259. {
  260. id: cancel_button
  261. anchors
  262. {
  263. right: ok_button.left
  264. rightMargin: UM.Theme.getSize("default_margin").width
  265. }
  266. text: catalog.i18nc("@action:button","Cancel");
  267. enabled: true
  268. onClicked: close()
  269. }
  270. Button
  271. {
  272. id: ok_button
  273. anchors.right: parent.right
  274. text: catalog.i18nc("@action:button","Save");
  275. enabled: true
  276. onClicked:
  277. {
  278. close()
  279. yes()
  280. }
  281. }
  282. }
  283. }
  284. }