PrintSetupSelectorHeader.qml 3.1 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. wrapMode: Text.NoWrap
  38. UM.SettingPropertyProvider
  39. {
  40. id: layerHeight
  41. containerStack: Cura.MachineManager.activeStack
  42. key: "layer_height"
  43. watchedProperties: ["value"]
  44. }
  45. }
  46. Cura.IconWithText
  47. {
  48. source: UM.Theme.getIcon("Infill1")
  49. text: Cura.MachineManager.activeStack ? parseInt(infillDensity.properties.value) + "%" : "0%"
  50. font: UM.Theme.getFont("medium")
  51. iconSize: UM.Theme.getSize("medium_button_icon").width
  52. UM.SettingPropertyProvider
  53. {
  54. id: infillDensity
  55. containerStack: Cura.MachineManager.activeStack
  56. key: "infill_sparse_density"
  57. watchedProperties: ["value"]
  58. }
  59. }
  60. Cura.IconWithText
  61. {
  62. source: UM.Theme.getIcon("Support")
  63. text: supportEnabled.properties.value == "True" ? enabledText : disabledText
  64. font: UM.Theme.getFont("medium")
  65. iconSize: UM.Theme.getSize("medium_button_icon").width
  66. UM.SettingPropertyProvider
  67. {
  68. id: supportEnabled
  69. containerStack: Cura.MachineManager.activeMachine
  70. key: "support_enable"
  71. watchedProperties: ["value"]
  72. }
  73. }
  74. Cura.IconWithText
  75. {
  76. source: UM.Theme.getIcon("Adhesion")
  77. text: platformAdhesionType.properties.value != "skirt" && platformAdhesionType.properties.value != "none" ? enabledText : disabledText
  78. font: UM.Theme.getFont("medium")
  79. iconSize: UM.Theme.getSize("medium_button_icon").width
  80. UM.SettingPropertyProvider
  81. {
  82. id: platformAdhesionType
  83. containerStack: Cura.MachineManager.activeMachine
  84. key: "adhesion_type"
  85. watchedProperties: [ "value"]
  86. }
  87. }
  88. }