~josephjamesmills/+junk/americanFootball_api_stuff

« back to all changes in this revision

Viewing changes to Delegate/HomeDel.qml

  • Committer: Joseph Mills
  • Date: 2013-12-15 15:25:28 UTC
  • Revision ID: josephjamesmills@gmail.com-20131215152528-vke40bcaabivhpm9
for dude to pull stuff out

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import QtQuick.Window 2.0
 
3
import QtWebKit 3.0
 
4
import "../Javascript/Utils.js" as Utils
 
5
Rectangle {
 
6
    id: helloRoot
 
7
    width: parent.width
 
8
    height: parent.height
 
9
    color: "green"
 
10
    Rectangle{
 
11
        id: background
 
12
        width: parent.width
 
13
        height: parent.height
 
14
        color: "black"
 
15
        radius: 20
 
16
        border{
 
17
            width: 2
 
18
            color: "yellow"
 
19
        }
 
20
        state: "default"
 
21
        Behavior on height{NumberAnimation{duration: 900;}}
 
22
        MouseArea{
 
23
            anchors.fill: background
 
24
            onClicked: {
 
25
                if(background.state === "default"){
 
26
                    background.state = "showFull"
 
27
                }else{
 
28
                    background.state = "default"
 
29
                    Utils.destroyWebView()
 
30
                }
 
31
            }
 
32
        }
 
33
 
 
34
 
 
35
        Text {
 
36
            id: titleTxt
 
37
            text: title
 
38
            color: "white"
 
39
            y: background.state ===  "default" ? background.height / 2 - height/ 2 : 0
 
40
            anchors{
 
41
                horizontalCenter: background.horizontalCenter
 
42
            }
 
43
        }
 
44
 
 
45
 
 
46
        Rectangle{
 
47
            id: extraInfo
 
48
            width: background.width
 
49
            height: background.height / 1.2
 
50
            color: "#88C7C7C7"
 
51
 
 
52
 
 
53
            //this is the bottom color stuff
 
54
 
 
55
            opacity: background.state === "default" ? 0 : 1
 
56
            anchors.centerIn:  parent
 
57
            Column{
 
58
                spacing: 30
 
59
                width:parent.width / 1.3
 
60
                anchors.centerIn:  parent
 
61
                Text {
 
62
                    text: summary
 
63
                    wrapMode: Text.WordWrap
 
64
                    width: parent.width / 1.3
 
65
                    color: "white"
 
66
                }
 
67
                Text {
 
68
                    text: "by "+ author
 
69
                    color: "white"
 
70
 
 
71
                }
 
72
                Text {
 
73
                    text:{
 
74
                        var t = created
 
75
                        var s = Qt.formatDateTime(t, "dddd MMMM d hh:mm ap")
 
76
                        return    "created on \t" +     s
 
77
                    }
 
78
                    color: "white"
 
79
                }
 
80
                Text {
 
81
                    id:urlTxt
 
82
                    text: "Read Full Artical"// url
 
83
                    color: "white"
 
84
 
 
85
                    MouseArea{
 
86
                        anchors.fill: urlTxt;
 
87
                        hoverEnabled: true
 
88
                        onEntered: urlTxt.color = "blue"
 
89
                        onExited: urlTxt.color = "white"
 
90
                        onClicked: {
 
91
                            console.log(Utils.c.status )
 
92
//                            if(Utils.c.status)
 
93
                                Utils.createWebView();
 
94
                        }
 
95
                    }
 
96
                }
 
97
            }
 
98
        }
 
99
        states: [
 
100
            State {
 
101
                name: "showFull"
 
102
                PropertyChanges {
 
103
                    target: helloRoot
 
104
                    height: Screen.height
 
105
                    width: Screen.width
 
106
                }
 
107
                PropertyChanges { target: helloRoot.ListView.view; explicit: true; contentY: helloRoot.y }
 
108
                PropertyChanges { target: helloRoot.ListView.view; interactive: false }
 
109
 
 
110
            }
 
111
        ]
 
112
    }
 
113
}