GlobalProfileSelector.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. // Copyright (c) 2018 Ultimaker B.V.
  2. // Cura is released under the terms of the LGPLv3 or higher.
  3. import QtQuick 2.7
  4. import QtQuick.Controls 1.1
  5. import QtQuick.Controls.Styles 1.1
  6. import QtQuick.Layouts 1.2
  7. import UM 1.2 as UM
  8. import Cura 1.0 as Cura
  9. Item
  10. {
  11. id: globalProfileRow
  12. height: childrenRect.height
  13. Label
  14. {
  15. id: globalProfileLabel
  16. anchors
  17. {
  18. top: parent.top
  19. bottom: parent.bottom
  20. left: parent.left
  21. right: globalProfileSelection.left
  22. }
  23. text: catalog.i18nc("@label", "Profile")
  24. font: UM.Theme.getFont("medium")
  25. color: UM.Theme.getColor("text")
  26. verticalAlignment: Text.AlignVCenter
  27. }
  28. ToolButton
  29. {
  30. id: globalProfileSelection
  31. text: generateActiveQualityText()
  32. width: UM.Theme.getSize("print_setup_big_item").width
  33. height: UM.Theme.getSize("print_setup_big_item").height
  34. anchors
  35. {
  36. top: parent.top
  37. right: parent.right
  38. }
  39. tooltip: Cura.MachineManager.activeQualityOrQualityChangesName
  40. style: UM.Theme.styles.print_setup_header_button
  41. activeFocusOnPress: true
  42. menu: Cura.ProfileMenu { }
  43. function generateActiveQualityText()
  44. {
  45. var result = Cura.MachineManager.activeQualityOrQualityChangesName
  46. if (Cura.MachineManager.isActiveQualityExperimental)
  47. {
  48. result += " (Experimental)"
  49. }
  50. if (Cura.MachineManager.isActiveQualitySupported)
  51. {
  52. if (Cura.MachineManager.activeQualityLayerHeight > 0)
  53. {
  54. result += " <font color=\"" + UM.Theme.getColor("text_detail") + "\">"
  55. result += " - "
  56. result += Cura.MachineManager.activeQualityLayerHeight + "mm"
  57. result += "</font>"
  58. }
  59. }
  60. return result
  61. }
  62. UM.SimpleButton
  63. {
  64. id: customisedSettings
  65. visible: Cura.MachineManager.hasUserSettings
  66. width: UM.Theme.getSize("print_setup_icon").width
  67. height: UM.Theme.getSize("print_setup_icon").height
  68. anchors.verticalCenter: parent.verticalCenter
  69. anchors.right: parent.right
  70. anchors.rightMargin: Math.round(UM.Theme.getSize("setting_preferences_button_margin").width - UM.Theme.getSize("thick_margin").width)
  71. color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button");
  72. iconSource: UM.Theme.getIcon("star")
  73. onClicked:
  74. {
  75. forceActiveFocus();
  76. Cura.Actions.manageProfiles.trigger()
  77. }
  78. onEntered:
  79. {
  80. var content = catalog.i18nc("@tooltip","Some setting/override values are different from the values stored in the profile.\n\nClick to open the profile manager.")
  81. base.showTooltip(globalProfileRow, Qt.point(-UM.Theme.getSize("default_margin").width, 0), content)
  82. }
  83. onExited: base.hideTooltip()
  84. }
  85. }
  86. }