OpenPanelButton.qml 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import QtQuick 2.2
  2. import QtQuick.Controls 1.1
  3. import QtQuick.Controls.Styles 1.1
  4. import UM 1.1 as UM
  5. Button {
  6. objectName: "openPanelSaveAreaButton"
  7. id: openPanelSaveAreaButton
  8. UM.I18nCatalog { id: catalog; name: "cura"; }
  9. height: UM.Theme.getSize("save_button_save_to_button").height
  10. tooltip: catalog.i18nc("@info:tooltip", "Opens the print jobs page with your default web browser.")
  11. text: catalog.i18nc("@action:button", "View print jobs")
  12. // FIXME: This button style is copied and duplicated from SaveButton.qml
  13. style: ButtonStyle {
  14. background: Rectangle
  15. {
  16. border.width: UM.Theme.getSize("default_lining").width
  17. border.color:
  18. {
  19. if(!control.enabled)
  20. return UM.Theme.getColor("action_button_disabled_border");
  21. else if(control.pressed)
  22. return UM.Theme.getColor("print_button_ready_pressed_border");
  23. else if(control.hovered)
  24. return UM.Theme.getColor("print_button_ready_hovered_border");
  25. else
  26. return UM.Theme.getColor("print_button_ready_border");
  27. }
  28. color:
  29. {
  30. if(!control.enabled)
  31. return UM.Theme.getColor("action_button_disabled");
  32. else if(control.pressed)
  33. return UM.Theme.getColor("print_button_ready_pressed");
  34. else if(control.hovered)
  35. return UM.Theme.getColor("print_button_ready_hovered");
  36. else
  37. return UM.Theme.getColor("print_button_ready");
  38. }
  39. Behavior on color { ColorAnimation { duration: 50; } }
  40. implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("sidebar_margin").width * 2)
  41. Label {
  42. id: actualLabel
  43. anchors.centerIn: parent
  44. color:
  45. {
  46. if(!control.enabled)
  47. return UM.Theme.getColor("action_button_disabled_text");
  48. else if(control.pressed)
  49. return UM.Theme.getColor("print_button_ready_text");
  50. else if(control.hovered)
  51. return UM.Theme.getColor("print_button_ready_text");
  52. else
  53. return UM.Theme.getColor("print_button_ready_text");
  54. }
  55. font: UM.Theme.getFont("action_button")
  56. text: control.text;
  57. }
  58. }
  59. label: Item { }
  60. }
  61. }