WorkspaceSummaryDialog.qml 11 KB

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