WorkspaceSummaryDialog.qml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. property string variantName: Cura.MachineManager.activeVariantNames[modelData] !== undefined ? Cura.MachineManager.activeVariantNames[modelData]: ""
  145. property string materialName: Cura.MachineManager.getExtruder(modelData).material.name !== undefined ? Cura.MachineManager.getExtruder(modelData).material.name : ""
  146. Label
  147. {
  148. text: {
  149. var extruder = Number(modelData)
  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
  158. }
  159. return catalog.i18nc("@action:label", "Extruder %1").arg(extruder_id)
  160. }
  161. font.bold: true
  162. }
  163. Row
  164. {
  165. width: parent.width
  166. height: childrenRect.height
  167. Label
  168. {
  169. text:
  170. {
  171. if(variantName !== "" && materialName !== "")
  172. {
  173. return catalog.i18nc("@action:label", "%1 & material").arg(Cura.MachineManager.activeDefinitionVariantsName)
  174. }
  175. return catalog.i18nc("@action:label", "Material")
  176. }
  177. width: Math.floor(scroll.width / 3) | 0
  178. }
  179. Label
  180. {
  181. text:
  182. {
  183. if(variantName !== "" && materialName !== "")
  184. {
  185. return variantName + ", " + materialName
  186. }
  187. return materialName
  188. }
  189. width: Math.floor(scroll.width / 3) | 0
  190. }
  191. }
  192. }
  193. }
  194. Column
  195. {
  196. width: parent.width
  197. height: childrenRect.height
  198. Label
  199. {
  200. text: catalog.i18nc("@action:label", "Profile settings")
  201. font.bold: true
  202. }
  203. Row
  204. {
  205. width: parent.width
  206. Label
  207. {
  208. text: catalog.i18nc("@action:label", "Not in profile")
  209. width: Math.floor(scroll.width / 3) | 0
  210. }
  211. Label
  212. {
  213. text: catalog.i18ncp("@action:label", "%1 override", "%1 overrides", Cura.MachineManager.numUserSettings).arg(Cura.MachineManager.numUserSettings)
  214. width: Math.floor(scroll.width / 3) | 0
  215. }
  216. visible: Cura.MachineManager.numUserSettings
  217. }
  218. Row
  219. {
  220. width: parent.width
  221. height: childrenRect.height
  222. Label
  223. {
  224. text: catalog.i18nc("@action:label", "Name")
  225. width: Math.floor(scroll.width / 3) | 0
  226. }
  227. Label
  228. {
  229. text: Cura.MachineManager.activeQualityOrQualityChangesName
  230. width: Math.floor(scroll.width / 3) | 0
  231. }
  232. }
  233. }
  234. }
  235. }
  236. Item
  237. {
  238. id: controls
  239. width: parent.width
  240. height: childrenRect.height
  241. anchors.bottom: parent.bottom
  242. CheckBox
  243. {
  244. id: dontShowAgainCheckbox
  245. anchors.left: parent.left
  246. text: catalog.i18nc("@action:label", "Don't show project summary on save again")
  247. checked: dontShowAgain
  248. }
  249. Button
  250. {
  251. id: cancel_button
  252. anchors
  253. {
  254. right: ok_button.left
  255. rightMargin: UM.Theme.getSize("default_margin").width
  256. }
  257. text: catalog.i18nc("@action:button","Cancel");
  258. enabled: true
  259. onClicked: close()
  260. }
  261. Button
  262. {
  263. id: ok_button
  264. anchors.right: parent.right
  265. text: catalog.i18nc("@action:button","Save");
  266. enabled: true
  267. onClicked:
  268. {
  269. close()
  270. yes()
  271. }
  272. }
  273. }
  274. }
  275. }