LogView.qml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import Qt 4.7
  2. Item {
  3. id: logView
  4. width: screenWidth; height: screenHeight
  5. property bool loading: feedModel.status == XmlListModel.Loading
  6. Behavior on x { PropertyAnimation {} }
  7. Rectangle {
  8. anchors.fill: parent
  9. opacity: 1.0
  10. color: heiaDarkGrey
  11. border.width: heiaBorderWidth
  12. border.color: heiaLightGrey
  13. radius: heiaBorderWidth
  14. }
  15. XmlListModel {
  16. id: feedModel
  17. source: "http://www.heiaheia.com/users/" + appItem.userId + "/feed"
  18. query: "/rss/channel/item"
  19. XmlRole { name: "title"; query: "title/string()" }
  20. XmlRole { name: "description"; query: "description/string()" }
  21. XmlRole { name: "pubDate"; query: "pubDate/string()" }
  22. XmlRole { name: "author"; query: "author/string()" }
  23. }
  24. ListView {
  25. id: list
  26. anchors.fill: parent
  27. model: feedModel
  28. delegate: feed
  29. spacing: 10
  30. header: Item { height: 10 }
  31. }
  32. Component {
  33. id: feed
  34. Rectangle {
  35. id: listItem
  36. x: 10; y: 10
  37. height: content.height
  38. width: logView.width - 20
  39. border.width: 2
  40. border.color: heiaLightGrey
  41. color: "transparent"
  42. radius: 8
  43. Column {
  44. id: content
  45. width: parent.width
  46. spacing: 10
  47. Text {
  48. x: 10; y: 10
  49. width: parent.width - 20
  50. id: titleText
  51. text: title;
  52. color: heiaYellow
  53. font.family: appItem.applicationFont
  54. font.pixelSize: appItem.applicationFontSize
  55. elide: Text.ElideRight
  56. }
  57. Row {
  58. id: created
  59. height: 30
  60. x: 10
  61. width: parent.width - 20
  62. spacing: 10
  63. Text {
  64. id: authorText
  65. text: author
  66. color: heiaLightGrey
  67. font.family: appItem.applicationFont
  68. font.pixelSize: appItem.applicationFontSize - 10
  69. wrapMode: Text.Wrap
  70. }
  71. Text {
  72. horizontalAlignment: Text.AlignRight
  73. id: pubDateText
  74. text: pubDate.substring(0,pubDate.length-15)
  75. color: heiaLightGrey
  76. font.family: appItem.applicationFont
  77. font.pixelSize: appItem.applicationFontSize - 10
  78. font.italic: true
  79. wrapMode: Text.Wrap
  80. }
  81. }
  82. Text {
  83. id: descriptionText
  84. text: description
  85. x: 10
  86. width: parent.width - 20
  87. height: 30
  88. color: heiaLightGrey
  89. font.family: appItem.applicationFont
  90. font.pixelSize: appItem.applicationFontSize - 8
  91. elide: Text.ElideRight
  92. }
  93. }
  94. }
  95. }
  96. }