ProjectSummaryCard.qml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Copyright (C) 2021 Ultimaker B.V.
  2. import QtQuick 2.10
  3. import QtQuick.Controls 2.3
  4. import UM 1.2 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("toolbox_thumbnail_small").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. Label
  56. {
  57. id: displayNameLabel
  58. width: parent.width
  59. height: Math.round(parent.height / 3)
  60. elide: Text.ElideRight
  61. color: UM.Theme.getColor("text")
  62. font: UM.Theme.getFont("default_bold")
  63. }
  64. Label
  65. {
  66. id: usernameLabel
  67. width: parent.width
  68. height: Math.round(parent.height / 3)
  69. elide: Text.ElideRight
  70. color: UM.Theme.getColor("small_button_text")
  71. font: UM.Theme.getFont("default")
  72. }
  73. Label
  74. {
  75. id: lastUpdatedLabel
  76. width: parent.width
  77. height: Math.round(parent.height / 3)
  78. elide: Text.ElideRight
  79. color: UM.Theme.getColor("small_button_text")
  80. font: UM.Theme.getFont("default")
  81. }
  82. }
  83. }
  84. }