WorkspaceSummaryDialog.qml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. }
  219. }
  220. Item
  221. {
  222. id: controls
  223. width: parent.width
  224. height: childrenRect.height
  225. anchors.bottom: parent.bottom
  226. CheckBox
  227. {
  228. id: dontShowAgainCheckbox
  229. anchors.left: parent.left
  230. text: catalog.i18nc("@action:label", "Don't show project summary on save again")
  231. checked: dontShowAgain
  232. }
  233. Button
  234. {
  235. id: cancel_button
  236. anchors
  237. {
  238. right: ok_button.left
  239. rightMargin: UM.Theme.getSize("default_margin").width
  240. }
  241. text: catalog.i18nc("@action:button","Cancel");
  242. enabled: true
  243. onClicked: close()
  244. }
  245. Button
  246. {
  247. id: ok_button
  248. anchors.right: parent.right
  249. text: catalog.i18nc("@action:button","Save");
  250. enabled: true
  251. onClicked:
  252. {
  253. close()
  254. yes()
  255. }
  256. }
  257. }
  258. }
  259. }