CommitInfo.qml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import QtQuick 2.0
  2. Item {
  3. id: root
  4. property QtObject model: null
  5. state: "closed"
  6. clip: true
  7. states: [
  8. State {
  9. name: "opened"
  10. PropertyChanges {
  11. target: root
  12. height: childrenRect.height
  13. }
  14. },
  15. State {
  16. name: "closed"
  17. PropertyChanges {
  18. target: root
  19. height: shortInfo.height
  20. }
  21. },
  22. State {
  23. name: "hidden"
  24. when: !root.visible || model == null
  25. PropertyChanges {
  26. target: root
  27. height: 0
  28. }
  29. }
  30. ]
  31. onModelChanged:{
  32. if(model != null) {
  33. root.state = "closed"
  34. }
  35. }
  36. transitions: Transition {
  37. NumberAnimation {
  38. properties: "height"
  39. duration: 200
  40. }
  41. }
  42. Column {
  43. id: shortInfo
  44. anchors.top: parent.top
  45. width: parent.width
  46. CommitInfoLine {
  47. field: qsTr("Time")
  48. value: model ? model.time : ""
  49. }
  50. CommitInfoLine {
  51. field: qsTr("Author")
  52. value: model ? model.author : ""
  53. }
  54. CommitInfoLine {
  55. field: qsTr("Email")
  56. value: model ? model.email : ""
  57. }
  58. CommitInfoLine {
  59. field: qsTr("Summary")
  60. value: model ? model.summary : ""
  61. }
  62. }
  63. Image {
  64. id: merge
  65. visible: model ? model.isMerge : false
  66. source: "qrc:///images/flow-merge.png"
  67. anchors.right: shortInfo.right
  68. anchors.rightMargin: 5
  69. anchors.top: shortInfo.top
  70. }
  71. Column {
  72. anchors.top: shortInfo.bottom
  73. width: parent.width
  74. Text {
  75. wrapMode: Text.WordWrap
  76. width: contentWidth
  77. height: contentHeight
  78. text: qsTr("Message") + ": "
  79. font.pointSize: 10
  80. font.weight: Font.Bold
  81. }
  82. Rectangle {
  83. width: 10
  84. height: 10
  85. }
  86. Text {
  87. id: content
  88. wrapMode: Text.WordWrap
  89. width: parent.width
  90. height: contentHeight
  91. text: model ? model.message : ""
  92. }
  93. Rectangle {
  94. anchors.horizontalCenter: parent.horizontalCenter
  95. width: parent.width - 4
  96. height: 2
  97. radius: 2
  98. color: "#eeeeee"
  99. }
  100. Rectangle {
  101. width: 10
  102. height: 10
  103. }
  104. }
  105. }