PrintSetupSelectorHeader.qml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 2.3
  5. import QtQuick.Layouts 1.3
  6. import UM 1.3 as UM
  7. import Cura 1.0 as Cura
  8. RowLayout
  9. {
  10. property string enabledText: catalog.i18nc("@label:Should be short", "On")
  11. property string disabledText: catalog.i18nc("@label:Should be short", "Off")
  12. Cura.IconWithText
  13. {
  14. source: UM.Theme.getIcon("Sliders", "medium")
  15. iconSize: UM.Theme.getSize("button_icon").width
  16. text:
  17. {
  18. if (Cura.MachineManager.activeStack)
  19. {
  20. var resultMap = Cura.MachineManager.activeQualityDisplayNameMap
  21. var text = resultMap["main"]
  22. if (resultMap["suffix"])
  23. {
  24. text += " - " + resultMap["suffix"]
  25. }
  26. if (!Cura.MachineManager.hasNotSupportedQuality)
  27. {
  28. text += " - " + layerHeight.properties.value + "mm"
  29. text += Cura.MachineManager.isActiveQualityExperimental ? " - " + catalog.i18nc("@label", "Experimental") : ""
  30. }
  31. return text
  32. }
  33. return ""
  34. }
  35. font: UM.Theme.getFont("medium")
  36. elide: Text.ElideMiddle
  37. UM.SettingPropertyProvider
  38. {
  39. id: layerHeight
  40. containerStack: Cura.MachineManager.activeStack
  41. key: "layer_height"
  42. watchedProperties: ["value"]
  43. }
  44. }
  45. Cura.IconWithText
  46. {
  47. source: UM.Theme.getIcon("Infill1")
  48. text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%"
  49. font: UM.Theme.getFont("medium")
  50. iconSize: UM.Theme.getSize("medium_button_icon").width
  51. UM.SettingPropertyProvider
  52. {
  53. id: infillDensity
  54. containerStack: Cura.MachineManager.activeStack
  55. key: "infill_sparse_density"
  56. watchedProperties: ["value"]
  57. }
  58. }
  59. Cura.IconWithText
  60. {
  61. source: UM.Theme.getIcon("Support")
  62. text: supportEnabled.properties.value == "True" ? enabledText : disabledText
  63. font: UM.Theme.getFont("medium")
  64. iconSize: UM.Theme.getSize("medium_button_icon").width
  65. UM.SettingPropertyProvider
  66. {
  67. id: supportEnabled
  68. containerStack: Cura.MachineManager.activeMachine
  69. key: "support_enable"
  70. watchedProperties: ["value"]
  71. }
  72. }
  73. Cura.IconWithText
  74. {
  75. source: UM.Theme.getIcon("Adhesion")
  76. text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText
  77. font: UM.Theme.getFont("medium")
  78. iconSize: UM.Theme.getSize("medium_button_icon").width
  79. UM.SettingPropertyProvider
  80. {
  81. id: platformAdhesionType
  82. containerStack: Cura.MachineManager.activeMachine
  83. key: "adhesion_type"
  84. watchedProperties: [ "value"]
  85. }
  86. }
  87. }