diff options
Diffstat (limited to 'qml/tapasboard')
-rw-r--r-- | qml/tapasboard/BoardPage.qml | 34 | ||||
-rw-r--r-- | qml/tapasboard/EmptyListDelegate.qml | 29 | ||||
-rw-r--r-- | qml/tapasboard/ForumPage.qml | 28 | ||||
-rw-r--r-- | qml/tapasboard/TopicPage.qml | 63 |
4 files changed, 149 insertions, 5 deletions
diff --git a/qml/tapasboard/BoardPage.qml b/qml/tapasboard/BoardPage.qml index 7c3f1cd..57d362d 100644 --- a/qml/tapasboard/BoardPage.qml +++ b/qml/tapasboard/BoardPage.qml @@ -35,8 +35,34 @@ Page { text: section } - delegate: ListDelegate { + delegate: EmptyListDelegate { + id: forumItem + + height: Math.max(forumItemColumn.height + UiConstants.ButtonSpacing * 2, UiConstants.ListItemHeightDefault) + + Column { + id: forumItemColumn + anchors.left: parent.left + anchors.right: forumItemImage.left + anchors.verticalCenter: parent.verticalCenter + + Text { + text: model.title + width: parent.width + font: UiConstants.TitleFont + } + + Text { + text: model.description + width: parent.width + font: UiConstants.SubtitleFont + wrapMode: Text.Wrap + visible: text != "" + } + } + Image { + id: forumItemImage source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "") anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter @@ -44,9 +70,9 @@ Page { onClicked: { pageStack.push(Qt.resolvedUrl("ForumPage.qml"), { - boardUrl: boardPage.boardUrl, - forumId: model.forumId - }); + boardUrl: boardPage.boardUrl, + forumId: model.forumId + }); } } } diff --git a/qml/tapasboard/EmptyListDelegate.qml b/qml/tapasboard/EmptyListDelegate.qml new file mode 100644 index 0000000..9a9d63d --- /dev/null +++ b/qml/tapasboard/EmptyListDelegate.qml @@ -0,0 +1,29 @@ +import QtQuick 1.1 +import com.nokia.meego 1.1 + +Item { + id: listItem + + signal clicked + property alias pressed: mouseArea.pressed + + height: UiConstants.ListItemHeightDefault + width: parent.width + + BorderImage { + id: background + anchors.fill: parent + anchors.leftMargin: -UiConstants.DefaultMargin + anchors.rightMargin: -UiConstants.DefaultMargin + visible: pressed + source: theme.inverted ? "image://theme/meegotouch-panel-inverted-background-pressed" : "image://theme/meegotouch-panel-background-pressed" + } + + MouseArea { + id: mouseArea; + anchors.fill: parent + onClicked: { + listItem.clicked(); + } + } +} diff --git a/qml/tapasboard/ForumPage.qml b/qml/tapasboard/ForumPage.qml index a70fe74..6e39fe2 100644 --- a/qml/tapasboard/ForumPage.qml +++ b/qml/tapasboard/ForumPage.qml @@ -28,12 +28,38 @@ Page { boardUrl: forumPage.boardUrl forumId: forumPage.forumId } - delegate: ListDelegate { + delegate: EmptyListDelegate { + id: topicItem + + height: Math.max(topicItemColumn.height + UiConstants.ButtonSpacing * 2, UiConstants.ListItemHeightDefault) + + Column { + id: topicItemColumn + anchors.left: parent.left + anchors.right: topicItemImage.left + anchors.verticalCenter: parent.verticalCenter + + Text { + text: model.title + width: parent.width + font: UiConstants.TitleFont + wrapMode: Text.Wrap + } + } + Image { + id: topicItemImage source: "image://theme/icon-m-common-drilldown-arrow" + (theme.inverted ? "-inverse" : "") anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } + + onClicked: { + pageStack.push(Qt.resolvedUrl("TopicPage.qml"), { + boardUrl: forumPage.boardUrl, + topicId: model.topicId + }); + } } } diff --git a/qml/tapasboard/TopicPage.qml b/qml/tapasboard/TopicPage.qml new file mode 100644 index 0000000..d39d36e --- /dev/null +++ b/qml/tapasboard/TopicPage.qml @@ -0,0 +1,63 @@ +import QtQuick 1.1 +import com.nokia.meego 1.1 +import com.nokia.extras 1.1 +import com.javispedro.tapasboard 1.0 + +Page { + id: topicPage + + anchors.leftMargin: UiConstants.DefaultMargin + anchors.rightMargin: UiConstants.DefaultMargin + + property string boardUrl; + property int topicId; + + tools: ToolBarLayout { + ToolIcon { + id: backToolIcon + platformIconId: "toolbar-back" + anchors.left: parent.left + onClicked: pageStack.pop() + } + } + + ListView { + id: postsView + anchors.fill: parent + model: TopicModel { + boardUrl: topicPage.boardUrl + topicId: topicPage.topicId + } + delegate: Item { + id: postItem + + height: Math.max(postItemColumn.height + UiConstants.ButtonSpacing * 2, UiConstants.ListItemHeightDefault) + width: parent.width + + Column { + id: postItemColumn + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + + Text { + text: model.title + width: parent.width + font: UiConstants.TitleFont + visible: text != "" + } + + Text { + text: model.content + width: parent.width + font: UiConstants.SubtitleFont + wrapMode: Text.Wrap + } + } + } + } + + ScrollDecorator { + flickableItem: postsView + } +} |