StarredPageListDelegate.qml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2012 Róbert Márki
  4. **
  5. ** This file is part of Web Feeds.
  6. **
  7. ** Web Feeds is free software: you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation, either version 3 of the License, or
  10. ** (at your option) any later version.
  11. **
  12. ** Web Feeds is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with Web Feeds. If not, see <http://www.gnu.org/licenses/>.
  19. ****************************************************************************/
  20. import QtQuick 1.1
  21. import com.nokia.meego 1.0
  22. import "../../../../shared/qml" as Shared
  23. import "../../../../shared/qml/UIConstants.js" as UIConstants
  24. import "../misc" as Misc
  25. import NewsBlur 1.0
  26. Item {
  27. id: root
  28. signal released(int row)
  29. signal holded(int row)
  30. property int titleSize: UIConstants.LIST_TILE_SIZE
  31. property int titleWeight: Font.Bold
  32. property color titleColor: UIConstants.LIST_TITLE_COLOR
  33. property int subtitleSize: UIConstants.FONT_XXSMALL
  34. property int subtitleWeight: Font.Light
  35. property variant service
  36. height: UIConstants.XLARGE_DELEGATE_HEIGHT
  37. width: parent.width
  38. BorderImage {
  39. id: background
  40. anchors.fill: parent
  41. // Fill page porders
  42. anchors.leftMargin: -UIConstants.DEFAULT_MARGIN
  43. anchors.rightMargin: -UIConstants.DEFAULT_MARGIN
  44. visible: mouseArea.pressed
  45. source: "image://theme/meegotouch-panel-background-pressed"
  46. }
  47. Shared.Separator {
  48. id: separator
  49. anchors.top: parent.top
  50. anchors.left: parent.left
  51. anchors.leftMargin: UIConstants.DEFAULT_MARGIN
  52. anchors.right: parent.right
  53. anchors.rightMargin: UIConstants.DEFAULT_MARGIN
  54. visible: index
  55. }
  56. Item {
  57. id: conents
  58. anchors.top: parent.top
  59. anchors.bottom: parent.bottom
  60. anchors.left: parent.left
  61. anchors.leftMargin: 0
  62. anchors.right: parent.right
  63. anchors.rightMargin: UIConstants.DEFAULT_MARGIN
  64. Misc.UnreadMark {
  65. id: unreadMark
  66. anchors.left: parent.left
  67. anchors.leftMargin: UIConstants.DEFAULT_HALF_MARGIN
  68. anchors.top: parent.top
  69. anchors.topMargin: UIConstants.PADDING_MEDIUM
  70. anchors.bottom: parent.bottom
  71. anchors.bottomMargin: UIConstants.PADDING_SMALL
  72. active: !model.isRead
  73. classification: model.itemClassification
  74. }
  75. Text {
  76. id: mainText
  77. anchors.top: parent.top
  78. anchors.topMargin: UIConstants.DELEGATE_TOP_MARGIN
  79. anchors.left: unreadMark.right
  80. anchors.leftMargin: 12
  81. anchors.right: starImage.left
  82. anchors.rightMargin: UIConstants.LIST_ITEM_SPACING
  83. text: model.title
  84. font.family: UIConstants.FONT_FAMILY
  85. font.weight: root.titleWeight
  86. font.pixelSize: root.titleSize
  87. color: root.titleColor
  88. elide: Text.ElideRight
  89. wrapMode: Text.Wrap
  90. maximumLineCount: 2
  91. textFormat: Text.PlainText
  92. }
  93. Image {
  94. id: starImage
  95. anchors.right: parent.right
  96. anchors.top: parent.top
  97. anchors.topMargin: UIConstants.LIST_ITEM_SPACING
  98. source: "qrc:/plugins/newsblur/images/star_mark.png"
  99. width: model.starred ? 32 : 0
  100. height: model.starred ? 32 : 0
  101. visible: model.starred
  102. }
  103. Text {
  104. id: feedTitleText
  105. anchors.bottom: parent.bottom
  106. anchors.bottomMargin: UIConstants.PADDING_XXXLARGE
  107. anchors.left: unreadMark.right
  108. anchors.leftMargin: 12
  109. anchors.right: parent.right
  110. text: root.service.feedTitle(model.feedId);
  111. font.pixelSize: UIConstants.FONT_LLSMALL
  112. font.family: UIConstants.FONT_FAMILY_LIGHT
  113. color: "black"
  114. visible: text.length
  115. elide: Text.ElideRight
  116. textFormat: Text.PlainText
  117. }
  118. Text {
  119. id: dateTimeText
  120. anchors.bottom: parent.bottom
  121. anchors.bottomMargin: UIConstants.DELEGATE_BOTTOM_MARGINT
  122. anchors.left: unreadMark.right
  123. anchors.leftMargin: 12
  124. anchors.right: parent.right
  125. text: model.formattedDate
  126. font.family: UIConstants.FONT_FAMILY
  127. font.weight: root.subtitleWeight
  128. font.pixelSize: root.subtitleSize
  129. color: model.isRead ? UIConstants.LIST_SUBTITLE_COLOR : unreadMark.color
  130. width: parent.width
  131. visible: text.length
  132. maximumLineCount: 1
  133. elide: Text.ElideRight
  134. wrapMode: Text.NoWrap
  135. textFormat: Text.PlainText
  136. }
  137. }
  138. MouseArea {
  139. id: mouseArea;
  140. anchors.fill: parent
  141. onReleased: {
  142. if(!mouse.wasHeld)
  143. root.released(index);
  144. }
  145. onPressAndHold: {
  146. root.holded(index);
  147. }
  148. }
  149. }