import Qt 4.7
import "VHTwitter" 1.0 as Twitter

Item {
    id: main
    width: 320
    height: 480
    Rectangle {
        anchors.fill: parent
        border.width: 3
        border.color: "#009b42"
        radius: 10

        /**
         * Displays possible errors
         */
        Rectangle {
            width: parent.height/2 + 30
            height: parent.height/4
            z: 2
            radius: 10
            border.color: "red"
            border.width: 2

            color: "black"
            opacity: 0.7
            visible: rssModel.status==XmlListModel.Error
            anchors.centerIn: parent
            Text {
                id: errorText
                anchors.centerIn: parent
                text: "Could not access twitter."
                color: "#FFFFFF"
                style: Text.Raised
                styleColor: "black"
                wrapMode: Text.WordWrap
            }
        }

        /**
         * LogoBar refers to another file where we declare
         * how to display the logobar
         */
        LogoBar {
            id: logoBar
        }

        /**
         * VHTwitter refers to another file where we create the
         * model which then populates the ListView
         */
        Twitter.VHTwitter {
            id: rssModel
        }

        /**
         * Delegate refers to another file where we express the
         * way we want to display a single item in the ListView
         */
        Twitter.Delegate {
            id: tweetDelegate
        }

        /**
         * This will create the list which is populated by
         * the feed entries from Twitter.
         */
        ListView {
            id: mainView
            model: rssModel
            delegate: tweetDelegate

            height: main.height
            width: main.width

            anchors.top: logoBar.bottom

            cacheBuffer: 100
        }
    }
}
