~andrewsomething/+junk/stackbrowser

« back to all changes in this revision

Viewing changes to StackBrowserListView.qml

  • Committer: Andrew Starr-Bochicchio
  • Date: 2013-09-04 21:43:49 UTC
  • Revision ID: a.starr.b@gmail.com-20130904214349-pc208uzp6az7kdrq
Get the basic question view together.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
import Ubuntu.Components 0.1
3
3
import Ubuntu.Components.ListItems 0.1 as ListItem
4
4
 
5
 
Item {
 
5
 
 
6
ListView {
 
7
    id: stackList
6
8
    anchors.fill: parent
7
9
 
8
 
    function reload() {
9
 
        stackFeed.reload()
10
 
    }
11
 
 
12
 
//    Rectangle {
13
 
//        id: stackLogo
14
 
//        anchors {
15
 
//            right: parent.right
16
 
//            left: parent.left
17
 
//        }
18
 
//        height: units.gu(10)
19
 
//        Image {
20
 
//            anchors.fill: parent
21
 
//            fillMode: Image.PreserveAspectFit
22
 
//            source: Qt.resolvedUrl(logo)
23
 
//        }
24
 
//    }
25
 
 
26
 
    ListView {
27
 
        id: stackList
28
 
        anchors.top: parent.top // stackLogo.bottom
29
 
        anchors.bottom: parent.bottom
30
 
        anchors.left: parent.left
31
 
        anchors.right: parent.right
32
 
 
33
 
        model: StackListModel {
34
 
             id: stackFeed
35
 
             path: "questions"
36
 
             query: "$.items[*]"
37
 
             args: "order=desc&sort=activity&pagesize=50"
38
 
             site: stackView.site
39
 
         }
40
 
 
41
 
        delegate: ListItem.Subtitled {
42
 
            id: stackItemDelegate
43
 
            text: model.title
44
 
            subText: model.answer_count + " answers    -    Asked by: " + model.owner['display_name']
45
 
            iconFrame: true
46
 
            icon: UbuntuShape {
47
 
                    color: model.is_answered ? "green" : "gray"
48
 
                    Label{
49
 
                        anchors.centerIn: parent
50
 
                        fontSize: "large"
51
 
                        text: model.score
52
 
                        color: "white"
53
 
                    }
 
10
    model: StackListModel {
 
11
         id: stackFeed
 
12
         path: "questions"
 
13
         query: "$.items[*]"
 
14
         args: "order=desc&sort=activity&pagesize=50"
 
15
         site: stackView.site
 
16
     }
 
17
 
 
18
    delegate: ListItem.Subtitled {
 
19
        id: stackItemDelegate
 
20
        text: model.title
 
21
        subText: model.answer_count + " answers    -    Asked by: " + model.owner['display_name']
 
22
        iconFrame: true
 
23
        icon: UbuntuShape {
 
24
                color: model.accepted_answer_id ? "green" : "gray"
 
25
                Label{
 
26
                    anchors.centerIn: parent
 
27
                    fontSize: "large"
 
28
                    text: model.score
 
29
                    color: "white"
54
30
                }
55
 
            progression: true
56
 
            onClicked: {
57
 
               questionViewer.question = model.question_id
58
 
               pageStack.push(questionViewer)
59
31
            }
 
32
        progression: true
 
33
        onClicked: {
 
34
           questionViewer.question = model.question_id
 
35
           pageStack.push(questionViewer)
60
36
        }
61
37
    }
62
38
}