~josephjamesmills/+junk/myth-remote

« back to all changes in this revision

Viewing changes to bk/Schedule.qml

  • Committer: Joseph Mills
  • Date: 2013-05-05 22:03:20 UTC
  • Revision ID: joseph_mills_-20130505220320-rge30iwmkb216dwi
updating 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import QtQuick.LocalStorage 2.0
 
3
import Ubuntu.Components 0.1
 
4
import QtQuick.XmlListModel 2.0
 
5
import "common/dbUtil.js" as DataBase
 
6
import "common/Util.js" as Util
 
7
import "examples"
 
8
Rectangle {
 
9
    id:scheduleRoot
 
10
    width: parent.width
 
11
    height: parent.height
 
12
    Rectangle{
 
13
        id: singleChannelRec
 
14
        color: "black"
 
15
        width: scheduleRoot.width
 
16
        height: scheduleRoot.height
 
17
        y: scheduleRoot.height
 
18
        Behavior on y {NumberAnimation{duration: 900; easing.type: Easing.OutBack}}
 
19
        Behavior on opacity {NumberAnimation{duration: 1800; easing.type: Easing.OutQuad}}
 
20
        GridView {
 
21
            header: CTimeLine{}
 
22
            contentHeight: scheduleRoot.height
 
23
            contentWidth: scheduleRoot.width
 
24
            width: scheduleRoot.width
 
25
            height: scheduleRoot.height
 
26
            cellHeight: scheduleRoot.height / 4
 
27
            cellWidth: scheduleRoot.width
 
28
            clip: true
 
29
            model: scheduleChannel
 
30
            delegate: Item {
 
31
                width: scheduleRoot.width
 
32
                height: scheduleRoot.height / 4.2
 
33
                UbuntuShape{
 
34
                    id:slipp
 
35
                    width: scheduleRoot.width
 
36
                    height: scheduleRoot.height / 4.2
 
37
                    color: "grey"
 
38
                }
 
39
                Text {
 
40
                    id: show
 
41
                    text: Title
 
42
                    color: "white"
 
43
                    font.pixelSize: parent.height / 5
 
44
                    x:  scheduleRoot.width / 6
 
45
                }
 
46
 
 
47
                Rectangle{
 
48
                    id: descriptionRec
 
49
                    width: slipp.width / 1.5
 
50
                height: slipp.height / 1.5
 
51
               radius: 8
 
52
                anchors{
 
53
                   bottom: parent.bottom
 
54
               left: parent.left
 
55
               leftMargin: parent.height
 
56
               }
 
57
                   gradient: Gradient{
 
58
                        GradientStop { position: 0; color: "#88000000"}
 
59
                        GradientStop { position: 0.8; color: "#44C7C7C7"}
 
60
                        GradientStop { position: 1; color: "#88000000"}
 
61
                    }
 
62
                   Text {
 
63
                       id: description
 
64
                       text: Description
 
65
                       color: "white"
 
66
                       width: descriptionRec.width - ( descriptionRec.width / 20 )
 
67
                       wrapMode: Text.WordWrap
 
68
                       anchors{
 
69
                           left: parent.left
 
70
                           leftMargin: descriptionRec.width / 40
 
71
                           top: parent.top
 
72
                           topMargin: descriptionRec.height / 20
 
73
                       }
 
74
                   }
 
75
 
 
76
                }
 
77
 
 
78
 
 
79
 
 
80
 
 
81
 
 
82
 
 
83
 
 
84
 
 
85
 
 
86
                Text {
 
87
                    id: startTime
 
88
                    text: Qt.formatDateTime(StartTime, "h:mm \n ap")
 
89
                    color: "white"
 
90
                    font.pixelSize:  parent.height / 4
 
91
                    font.bold:  true
 
92
                }
 
93
                Text {
 
94
                    id: endTime
 
95
                    text: Qt.formatDateTime(EndTime, "h:mm \n ap")
 
96
                    color: "white"
 
97
                    font.pixelSize:  parent.height / 4
 
98
                    font.bold:  true
 
99
anchors{
 
100
    right: parent.right
 
101
}
 
102
}
 
103
 
 
104
 
 
105
 
 
106
 
 
107
 
 
108
            }
 
109
        }
 
110
    }
 
111
 
 
112
 
 
113
 
 
114
 
 
115
 
 
116
    //   ???????????????????????????????????????????//
 
117
    Rectangle{
 
118
        id: homeChannelRec
 
119
        color: "grey"
 
120
        width: scheduleRoot.width
 
121
        height: scheduleRoot.height
 
122
        GridView {
 
123
            focus: true
 
124
            contentHeight: scheduleRoot.height
 
125
            contentWidth: scheduleRoot.width
 
126
            width: scheduleRoot.width
 
127
            height: scheduleRoot.height
 
128
            cellHeight: scheduleRoot.height / 4
 
129
            cellWidth: scheduleRoot.width / 4
 
130
            clip: true
 
131
            model: schedule
 
132
            delegate: Item {
 
133
                width: scheduleRoot.width /4.2
 
134
                height: scheduleRoot.height / 4.2
 
135
                MouseArea{
 
136
                    anchors.fill: channelHomeButton
 
137
                    onClicked: {
 
138
                        singleChannelRec.y = 0
 
139
                        homeChannelRec.x = scheduleRoot.width
 
140
                        scheduleChannel.source =  DataBase.ipAddress()+":"+DataBase.port()+"/Guide/GetProgramGuide?StartTime="+Util.now.toISOString()+"&EndTime="+Util.time2.toISOString()+"&StartChanId="+ChanId+"&NumChannels=1"+"&Details=true"
 
141
                    }
 
142
                }
 
143
                UbuntuShape{
 
144
                    id:channelHomeButton
 
145
                    width: scheduleRoot.width / 4.2
 
146
                    height: scheduleRoot.height / 4.2
 
147
                    color: "grey"
 
148
                    image: Image{
 
149
                        id: channelHomeButtonImg
 
150
                        anchors.centerIn: parent
 
151
 
 
152
                        source:{
 
153
                        DataBase.ipAddress()+":"+DataBase.port()+IconURL
 
154
 
 
155
                        //FixMe Needs Draw back
 
156
                    }
 
157
                    }
 
158
                    Text {
 
159
                        id:nameQW
 
160
                        color: "white"
 
161
                        visible:  channelHomeButtonImg.status === Image.Error ? true : false
 
162
                        font.pixelSize: 12
 
163
                        text: CallSign
 
164
                        anchors.centerIn: parent
 
165
                    }
 
166
                }
 
167
            }
 
168
        }
 
169
    }
 
170
    //?????????????????????????????????????????????????????????????????????
 
171
 
 
172
    XmlListModel {
 
173
        id: schedule
 
174
        source: DataBase.ipAddress()+":"+DataBase.port()+"/Guide/GetProgramGuide?StartTime="+Util.now.toISOString()+"&EndTime="+Util.time2.toISOString()
 
175
        query: "/ProgramGuide/Channels/ChannelInfo"
 
176
        XmlRole {name: "ChanId"; query: "ChanId/string()"}
 
177
        XmlRole { name: "ChanNum"; query: "ChanNum/string()" }
 
178
        XmlRole { name: "CallSign"; query: "CallSign/string()" }
 
179
        XmlRole{name: "IconURL"; query: "IconURL/string()" }
 
180
        XmlRole{name: "ChannelName"; query: "ChannelName/string()" }
 
181
 
 
182
        //debug
 
183
        onStatusChanged: {
 
184
            if (status == XmlListModel.Ready){console.log("Loaded" + source)}
 
185
            if (status === XmlListModel.Loading) console.log("Loading");
 
186
            if (status === XmlListModel.Error) console.log("Error: " + errorString + "\n \n \n " + schedule.source.toString());
 
187
        }
 
188
        onCountChanged: {
 
189
            console.log("Count changed to: " + count)
 
190
        }
 
191
    }
 
192
 
 
193
    XmlListModel {
 
194
        id: scheduleChannel
 
195
        source:""
 
196
        query: "/ProgramGuide/Channels/ChannelInfo/Programs/Program"
 
197
        XmlRole {name: "StartTime"; query: "StartTime/string()"}
 
198
        XmlRole { name: "EndTime"; query: "EndTime/string()" }
 
199
        XmlRole { name: "Title"; query: "Title/string()" }
 
200
        XmlRole{name: "SubTitle"; query: "SubTitle/string()" }
 
201
        XmlRole{name: "Category"; query: "Category/string()" }
 
202
        XmlRole{name: "CatType"; query: "CatType/string()" }
 
203
        XmlRole{name: "Repeat"; query: "Repeat/string()" }
 
204
        XmlRole{name: "VideoProps"; query: "VideoProps/string()" }
 
205
        XmlRole{name: "AudioProps"; query: "AudioProps/string()" }
 
206
        XmlRole{name: "SubProps"; query: "SubProps/string()" }
 
207
        XmlRole{name: "Description"; query: "Description/string()" }
 
208
 
 
209
        XmlRole{name: "Status"; query: "Recording/Status/string()" }
 
210
        XmlRole{name: "Priority"; query: "Recording/Priority/string()" }
 
211
        XmlRole{name: "RecordId"; query: "Recording/RecordId/string()" }
 
212
        XmlRole{name: "RecGroup"; query: "RecGroup/RecGroup/string()" }
 
213
        XmlRole{name: "PlayGroup"; query: "Recording/PlayGroup/string()" }
 
214
        XmlRole{name: "StorageGroup"; query: "Recording/StorageGroup/string()" }
 
215
        XmlRole{name: "RecType"; query: "Recording/RecType/string()" }
 
216
        XmlRole{name: "DupInType"; query: "Recording/DupInType/string()" }
 
217
        XmlRole{name: "DupMethod"; query: "Recording/DupMethod/string()" }
 
218
        XmlRole{name: "EncoderId"; query: "Recording/EncoderId/string()" }
 
219
        XmlRole{name: "Profile"; query: "Recording/Profile/string()" }
 
220
        XmlRole{name: "ArtworkInfos"; query: "Artwork/ArtworkInfos/string()" }
 
221
 
 
222
        //debug
 
223
        onStatusChanged: {
 
224
            if (status === XmlListModel.Ready){console.log("Loaded" + source)}
 
225
            if (status === XmlListModel.Loading) console.log("Loading");
 
226
            if (status === XmlListModel.Error) console.log("Error: " + errorString + "\n \n \n " + source.toString());
 
227
        }
 
228
        onCountChanged: {
 
229
            console.log("Count changed to: " + count)
 
230
        }
 
231
    }
 
232
}