ProfileWarningReset.qml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import QtQuick 2.10
  2. import UM 1.6 as UM
  3. import Cura 1.6 as Cura
  4. Item
  5. {
  6. height: visible ? UM.Theme.getSize("action_button_icon").height : 0
  7. visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
  8. Rectangle
  9. {
  10. id: warningIcon
  11. color: UM.Theme.getColor("um_yellow_5")
  12. height: UM.Theme.getSize("action_button_icon").height
  13. width: height
  14. radius: width
  15. anchors
  16. {
  17. left: parent.left
  18. verticalCenter: parent.verticalCenter
  19. }
  20. UM.ColorImage
  21. {
  22. height: UM.Theme.getSize("action_button_icon").height
  23. width: height
  24. source: UM.Theme.getIcon("Warning", "low")
  25. }
  26. }
  27. UM.Label
  28. {
  29. id: warning
  30. width: parent.width - warningIcon.width - resetToDefaultQualityButton.width
  31. anchors
  32. {
  33. left: warningIcon.right
  34. verticalCenter: parent.verticalCenter
  35. leftMargin: UM.Theme.getSize("thin_margin").width
  36. }
  37. wrapMode: Text.WordWrap
  38. states: [
  39. State
  40. {
  41. name: "settings changed and custom quality"
  42. when: Cura.SimpleModeSettingsManager.isProfileCustomized && Cura.MachineManager.hasCustomQuality
  43. PropertyChanges
  44. {
  45. target: warning
  46. text: {
  47. var profile_name = Cura.MachineManager.activeQualityChangesGroup.name
  48. return catalog.i18nc("@info, %1 is the name of the custom profile", "<b>%1</b> custom profile is active and you overwrote some settings.").arg(profile_name)
  49. }
  50. }
  51. },
  52. State
  53. {
  54. name: "custom quality"
  55. when: Cura.MachineManager.hasCustomQuality
  56. PropertyChanges
  57. {
  58. target: warning
  59. text: {
  60. var profile_name = Cura.MachineManager.activeQualityChangesGroup.name
  61. return catalog.i18nc("@info, %1 is the name of the custom profile", "<b>%1</b> custom profile is overriding some settings.").arg(profile_name)
  62. }
  63. }
  64. },
  65. State
  66. {
  67. name: "settings changed"
  68. when: Cura.SimpleModeSettingsManager.isProfileCustomized
  69. PropertyChanges
  70. {
  71. target: warning
  72. text: catalog.i18nc("@info", "Some settings were changed.")
  73. }
  74. }
  75. ]
  76. }
  77. UM.SimpleButton
  78. {
  79. id: resetToDefaultQualityButton
  80. height: UM.Theme.getSize("action_button_icon").height
  81. width: height
  82. iconSource: UM.Theme.getIcon("ArrowReset")
  83. anchors
  84. {
  85. right: parent.right
  86. verticalCenter: parent.verticalCenter
  87. }
  88. color: UM.Theme.getColor("accent_1")
  89. onClicked:
  90. {
  91. Cura.MachineManager.resetToUseDefaultQuality()
  92. }
  93. }
  94. }