ProjectSummaryCard.qml 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // Copyright (C) 2021 Ultimaker B.V.
  2. import QtQuick 2.10
  3. import QtQuick.Controls 2.3
  4. import UM 1.5 as UM
  5. import Cura 1.6 as Cura
  6. Cura.RoundedRectangle
  7. {
  8. id: base
  9. width: parent.width
  10. height: projectImage.height + 2 * UM.Theme.getSize("default_margin").width
  11. cornerSide: Cura.RoundedRectangle.Direction.All
  12. border.color: UM.Theme.getColor("lining")
  13. border.width: UM.Theme.getSize("default_lining").width
  14. radius: UM.Theme.getSize("default_radius").width
  15. color: UM.Theme.getColor("main_background")
  16. signal clicked()
  17. property alias imageSource: projectImage.source
  18. property alias projectNameText: displayNameLabel.text
  19. property alias projectUsernameText: usernameLabel.text
  20. property alias projectLastUpdatedText: lastUpdatedLabel.text
  21. property alias cardMouseAreaEnabled: cardMouseArea.enabled
  22. onVisibleChanged: color = UM.Theme.getColor("main_background")
  23. MouseArea
  24. {
  25. id: cardMouseArea
  26. anchors.fill: parent
  27. hoverEnabled: true
  28. onEntered: base.color = UM.Theme.getColor("action_button_hovered")
  29. onExited: base.color = UM.Theme.getColor("main_background")
  30. onClicked: base.clicked()
  31. }
  32. Row
  33. {
  34. id: projectInformationRow
  35. width: parent.width
  36. padding: UM.Theme.getSize("default_margin").width
  37. spacing: UM.Theme.getSize("default_margin").width
  38. Image
  39. {
  40. id: projectImage
  41. anchors.verticalCenter: parent.verticalCenter
  42. width: UM.Theme.getSize("card_icon").width
  43. height: Math.round(width * 3/4)
  44. sourceSize.width: width
  45. sourceSize.height: height
  46. fillMode: Image.PreserveAspectFit
  47. mipmap: true
  48. }
  49. Column
  50. {
  51. id: projectLabelsColumn
  52. height: projectImage.height
  53. width: parent.width - x - UM.Theme.getSize("default_margin").width
  54. anchors.verticalCenter: parent.verticalCenter
  55. UM.Label
  56. {
  57. id: displayNameLabel
  58. width: parent.width
  59. height: Math.round(parent.height / 3)
  60. elide: Text.ElideRight
  61. font: UM.Theme.getFont("default_bold")
  62. }
  63. UM.Label
  64. {
  65. id: usernameLabel
  66. width: parent.width
  67. height: Math.round(parent.height / 3)
  68. elide: Text.ElideRight
  69. color: UM.Theme.getColor("small_button_text")
  70. }
  71. UM.Label
  72. {
  73. id: lastUpdatedLabel
  74. width: parent.width
  75. height: Math.round(parent.height / 3)
  76. elide: Text.ElideRight
  77. color: UM.Theme.getColor("small_button_text")
  78. }
  79. }
  80. }
  81. }