~josephjamesmills/ubuntutv/maps_fanart

« back to all changes in this revision

Viewing changes to shell/qtv-qml/content/SerieDelegate.qml.autosave

  • Committer: Joseph Mills
  • Date: 2012-07-28 14:57:10 UTC
  • Revision ID: josephjamesmills@gmail.com-20120728145710-sy00cvq1ja8o9qad
Lots of cool stuff. watch my youtube videos to see  what else has been added

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import Qt 4.7
 
2
import"../../common/utils.js" as Utils
 
3
import "../../common"
 
4
 
 
5
Item {
 
6
    id: serie
 
7
 
 
8
    property string name: ''
 
9
    property string overview: ''
 
10
    property string banner: ''
 
11
    property string seriesid: ''
 
12
    //    property string thumb: ''
 
13
    property int rating: -1
 
14
 
 
15
    function loadDetails(seriesid, name, overview, banner, ) {
 
16
        serie.seriesid = seriesid
 
17
        serie.name = name
 
18
        serie.overview = overview
 
19
        serie.banner = banner
 
20
        //       serie.thumb = thumb
 
21
        rating = -1
 
22
 
 
23
        serieModel.load(seriesid)
 
24
    }
 
25
 
 
26
    XmlListModel {
 
27
        id: serieModel
 
28
 
 
29
        function load(seriesId) {
 
30
            console.log("Loading " + seriesId)
 
31
            source = "http://thetvdb.com/api/040BCD04E3D1E109/series/" + seriesId + "/all/en.xml"
 
32
            reload();
 
33
        }
 
34
 
 
35
        source: ''
 
36
        query: "/Data/Series"
 
37
 
 
38
        XmlRole { name: "seriesid"; query: "id/string()" }
 
39
 
 
40
        XmlRole { name: "title"; query: "SeriesName/string()" }
 
41
 
 
42
        XmlRole { name: "banner"; query: "banner/string()" }
 
43
        XmlRole { name: "fanart"; query: "fanart/string()" }
 
44
        XmlRole { name: "poster"; query: "poster/string()" }
 
45
        XmlRole{name:"thumb";query:"thumb[1]/string()"}
 
46
        XmlRole { name: "status"; query: "Status/string()" }
 
47
        XmlRole { name: "runtime"; query: "Runtime/string()" }
 
48
        XmlRole { name: "rating"; query: "Rating/string()" }
 
49
        XmlRole { name: "network"; query: "Network/string()" }
 
50
        XmlRole { name: "firstaired"; query: "FirstAired/string()" }
 
51
 
 
52
        onStatusChanged: {
 
53
            if (status == XmlListModel.Ready) {
 
54
                if (get(0) !== undefined) {
 
55
                    console.log("Serie detailes loaded");
 
56
                    var tmp = get(0).rating;
 
57
                    if (tmp !== "") rating = tmp;
 
58
                    console.log("Rating: " + rating);
 
59
                }
 
60
            } else if (status == XmlListModel.Error) {
 
61
                console.log("Error: " + errorString);
 
62
            }
 
63
        }
 
64
    }
 
65
 
 
66
 
 
67
 
 
68
    Rectangle {
 
69
        id: background
 
70
        anchors.fill: parent
 
71
        color: "transparent"
 
72
        BorderImage {
 
73
            id: bakey
 
74
            source: "../../dash/artwork/search_background.png"
 
75
            width: parent.width ; height:parent.height
 
76
            border.left: 25; border.top: 25
 
77
            border.right: 25; border.bottom: 25
 
78
        }
 
79
    }
 
80
 
 
81
    Item {
 
82
        id: bannerLayout
 
83
        anchors.top: parent.top
 
84
 
 
85
        //make into FlipableTvBanner
 
86
        Image {
 
87
            id: bannerImg
 
88
            smooth: true
 
89
            anchors.top: parent.top
 
90
            anchors.topMargin: 5
 
91
            anchors.left: parent.left
 
92
            anchors.leftMargin: 7
 
93
            //            anchors.horizontalCenter: parent.horizontalCenter
 
94
            width: 700
 
95
            height: 150
 
96
            //fillMode: Image.PreserveAspectFit
 
97
            opacity: 0
 
98
                        source: "http://thetvdb.com/banners/_cache/" + serie.banner
 
99
//            source: "http://thetvdb.com/banners/graphical/"+ seriesid +"-g2.jpg"
 
100
        }
 
101
 
 
102
 
 
103
        states: State {
 
104
            name: "loaded"
 
105
            when: bannerImg.status == Image.Ready
 
106
            PropertyChanges {
 
107
                target: bannerImg
 
108
                opacity: 1
 
109
            }
 
110
            PropertyChanges {
 
111
                target: bannerLayout
 
112
                height: bannerImg.height
 
113
            }
 
114
        }
 
115
 
 
116
        transitions: Transition {
 
117
            PropertyAnimation { properties: "opacity, height"; duration: 300}
 
118
        }
 
119
    }
 
120
 
 
121
 
 
122
 
 
123
 
 
124
    //        Column{
 
125
    //            id:bannerart
 
126
    //            spacing: 0
 
127
    //Image {
 
128
    //id :faner
 
129
    //source: "http://thetvdb.com/banners/graphical/"+ seriesid +"-g3.jpg"
 
130
    //fillMode: Image.PreserveAspectFit
 
131
 
 
132
 
 
133
    //}
 
134
    //Image {
 
135
    //id :faner2
 
136
    //source: "http://thetvdb.com/banners/graphical/"+ seriesid +"-g2.jpg"
 
137
    //fillMode: Image.PreserveAspectFit
 
138
    //}
 
139
    //Image {
 
140
    //    id: faner3
 
141
    //    source: "http://thetvdb.com/banners/_cache/" + serie.banner
 
142
    //fillMode: Image.PreserveAspectFit
 
143
    //}
 
144
    //        }
 
145
 
 
146
 
 
147
    Image {
 
148
        anchors { right: flick.right; top: flick.top }
 
149
        source: "pics/moreUpW.png"
 
150
        opacity: flick.atYBeginning ? 0 : 1
 
151
    }
 
152
 
 
153
    Image {
 
154
        anchors { right: flick.right; bottom: flick.bottom }
 
155
        source: "pics/moreDownW.png"
 
156
        opacity: flick.atYEnd ? 0 : 1
 
157
    }
 
158
 
 
159
 
 
160
    Button {
 
161
        id: backButton
 
162
        height: 40
 
163
        anchors.right: parent.right
 
164
        anchors.bottom: parent.top
 
165
 
 
166
        state: serie.parent.state != '' ? "Show" : ""
 
167
 
 
168
        text: "Back"
 
169
 
 
170
        onClicked: {
 
171
            serie.parent.state = ''
 
172
        }
 
173
 
 
174
        states: [
 
175
            State {
 
176
                name: "Show"
 
177
                AnchorChanges {
 
178
                    target: backButton
 
179
                    anchors.bottom: undefined
 
180
                    anchors.top: backButton.parent.top
 
181
                }
 
182
            }
 
183
        ]
 
184
 
 
185
        transitions: [
 
186
            Transition {
 
187
                AnchorAnimation { duration: 300 }
 
188
            }
 
189
        ]
 
190
    }
 
191
 
 
192
    ProgresBar {
 
193
        id: progresBar
 
194
        visible: bannerImg.status == Image.Loading ? true : false
 
195
        width: parent.width * 0.3; height: 10
 
196
        anchors {bottom: parent.bottom; right: parent.right}
 
197
 
 
198
        value: bannerImg.progress
 
199
    }
 
200
 
 
201
 
 
202
 
 
203
 
 
204
    ///main plot
 
205
    BorderImage {
 
206
        id: informationtxt
 
207
        visible: true
 
208
        source: "../../dash/artwork/search_background.png"
 
209
        width: 450; height: 420
 
210
        border.left: 25; border.top: 25
 
211
        border.right: 25; border.bottom: 25
 
212
        anchors{
 
213
            top:parent.top
 
214
            topMargin: 200
 
215
            left:parent.left
 
216
            leftMargin: 700
 
217
    }
 
218
        }
 
219
        Flickable{
 
220
            Rectangle{
 
221
                id:placetxt
 
222
                visible: false
 
223
                anchors.fill: informationtxt
 
224
                color: "transparent"
 
225
                Text {
 
226
                    visible: true
 
227
                    anchors{
 
228
                        fill: placetxt
 
229
                    }
 
230
                    color: "white"
 
231
                    font.pixelSize: 22
 
232
                    text: serie.overview
 
233
                    //                width: informationtxt.width;height:informationtxt.height
 
234
                    wrapMode: Text.Wrap
 
235
                }
 
236
            }
 
237
        }
 
238
 
 
239
    //Seasons and Cast
 
240
 
 
241
 
 
242
    BorderImage {
 
243
        id: seasoncast
 
244
        visible: true
 
245
        source: "../../dash/artwork/search_background.png"
 
246
        width: 300; height: 420
 
247
        border.left: 25; border.top: 25
 
248
        border.right: 25; border.bottom: 25
 
249
        anchors{
 
250
            top:parent.top
 
251
            topMargin: 200
 
252
            left:parent.left
 
253
            leftMargin: 20
 
254
        }
 
255
 
 
256
        //Flickable{
 
257
        Rectangle{
 
258
            id:seasoncasttxt
 
259
            visible: false
 
260
            anchors.fill: informationtxt
 
261
            width: 280;height: 410
 
262
            color: "transparent"
 
263
 
 
264
        }
 
265
 
 
266
        Text {
 
267
            visible: true
 
268
            anchors{
 
269
                //                    top:informationtxt.top
 
270
                //                    bottom: informationtxt.bottom
 
271
                fill: seasoncasttxt
 
272
            }
 
273
            color: "white"
 
274
            font.pixelSize: 22
 
275
            text: serie.overview
 
276
            //                width: informationtxt.width;height:informationtxt.height
 
277
            wrapMode: Text.Wrap
 
278
        }
 
279
    }
 
280
 
 
281
 
 
282
 
 
283
 
 
284
    //Actor Pictures
 
285
 
 
286
    BorderImage {
 
287
        id: actorpictures
 
288
        visible: true
 
289
        source: "../../dash/artwork/search_background.png"
 
290
        width: 300; height: 420
 
291
        border.left: 25; border.top: 25
 
292
        border.right: 25; border.bottom: 25
 
293
        anchors{
 
294
            top:parent.top
 
295
            topMargin: 200
 
296
            left:parent.left
 
297
            leftMargin: 370
 
298
        }
 
299
    }
 
300
 
 
301
 
 
302
    //Bottom Picture make into Marquee
 
303
    BorderImage {
 
304
        id: bottompictures
 
305
        visible: true
 
306
        source: "../../dash/artwork/search_background.png"
 
307
        width: 250; height: 200
 
308
        border.left: 25; border.top: 25
 
309
        border.right: 25; border.bottom: 25
 
310
        anchors{
 
311
            top:parent.top
 
312
            topMargin: 650
 
313
            left:parent.left
 
314
            leftMargin: 20
 
315
        }
 
316
        Image {
 
317
            id: fan0
 
318
            source: "http://thetvdb.com/banners/posters/"+ seriesid +"-1.jpg"
 
319
        anchors.fill: bottompictures
 
320
        }
 
321
}
 
322
 
 
323
        BorderImage {
 
324
            id: bottompictures1
 
325
            visible: true
 
326
            source: "../../dash/artwork/search_background.png"
 
327
            width: 250; height: 200
 
328
            border.left: 25; border.top: 25
 
329
            border.right: 25; border.bottom: 25
 
330
            anchors{
 
331
                top:parent.top
 
332
                topMargin: 650
 
333
                left:parent.left
 
334
                leftMargin: 300
 
335
            }
 
336
            Image {
 
337
                id: fan1
 
338
                source: "http://thetvdb.com/banners/posters/"+ seriesid +"-2.jpg"
 
339
            anchors.fill: bottompictures1
 
340
            }
 
341
}
 
342
 
 
343
        BorderImage {
 
344
            id: bottompictures2
 
345
            visible: true
 
346
            source: "../../dash/artwork/search_background.png"
 
347
            width: 250; height: 200
 
348
            border.left: 25; border.top: 25
 
349
            border.right: 25; border.bottom: 25
 
350
            anchors{
 
351
                top:parent.top
 
352
                topMargin: 650
 
353
                left:parent.left
 
354
                leftMargin: 570
 
355
            }
 
356
            Image {
 
357
                id: fan2
 
358
                source: "http://thetvdb.com/banners/posters/"+ seriesid +"-3.jpg"
 
359
            anchors.fill: bottompictures2
 
360
            }
 
361
}
 
362
 
 
363
 
 
364
        BorderImage {
 
365
            id: bottompictures3
 
366
            visible: true
 
367
            source: "../../dash/artwork/search_background.png"
 
368
            width: 250; height: 200
 
369
            border.left: 25; border.top: 25
 
370
            border.right: 25; border.bottom: 25
 
371
            anchors{
 
372
                top:parent.top
 
373
                topMargin: 650
 
374
                left:parent.left
 
375
                leftMargin: 850
 
376
            }
 
377
            Image {
 
378
                id: fan3
 
379
                source: "http://thetvdb.com/banners/posters/"+ seriesid +"-4.jpg"
 
380
            anchors.fill: bottompictures3
 
381
            }
 
382
}
 
383
        //Top Right Text
 
384
    }
 
385