2
* Flashback - Entertainment app for Ubuntu
3
* Copyright (C) 2013, 2014 Nekhelesh Ramananthan <nik90@ubuntu.com>
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
20
import Ubuntu.Components 0.1
21
import Ubuntu.Components.ListItems 0.1
24
The Detail Carousel is very similar to Carousel. It shows additional information such as Episode title,
25
season and episode number and the release date. This carousel is primarily for displaying tv shows.
31
property alias header: _header.text
33
// Carousel Data Model
34
property alias dataModel: _carouselList.model
36
// Carousel Thumbnail size (On the phone, show 2 + 2/3 cover art always by dynamically adjusting the size)
37
property int size: parent.width < units.gu(50) ? (3 * (parent.width - 2*_carouselList.spacing))/8 : units.gu(17)
39
// Property to show/hide date
40
property bool showDate: true
42
// Signal triggered when a thumb
43
signal thumbClicked(var model)
47
visible: _carouselList.model.count > 0
48
height: _header.height + _carouselList.height
52
text: i18n.tr("Default Header Title")
59
height: 1.5*_detailCarousel.size + units.gu(5)
60
orientation: Qt.Horizontal
63
// Element consists of a Picture and a text label below it.
66
width: _detailCarousel.size
67
height: _thumbColumn.height
71
spacing: units.gu(0.5)
73
// Widget to curve edges and encase the thumbnail
77
width: _detailCarousel.size
78
height: 1.5*_detailCarousel.size
79
thumbSource: thumb_url
84
height: parent.height/5
93
height: _carouselThumb.height
100
color: Qt.rgba(0,0,0,0.8)
108
verticalCenter: parent.verticalCenter
112
// Label showing the tv episode name
116
elide: Text.ElideRight
124
// Container to hold the tv show season number and release date
126
height: childrenRect.height
134
text: "S" + season + "E" + episode
135
width: parent.width * (2/5)
136
elide: Text.ElideRight
138
anchors.left: parent.left
148
text: get_date(episode_air_date)
149
elide: Text.ElideRight
150
width: parent.width * (3/5)
151
anchors.right: parent.right
152
horizontalAlignment: Text.AlignRight
154
function get_date(iso) {
156
date = iso.split('T')[0].split('-')
157
month = Qt.locale().standaloneMonthName(date[1] - 1, Locale.ShortFormat)
158
return date[2] + " " + month
166
// Label showing the tv show name
168
id: _carouselThumbDescription
171
elide: Text.ElideRight
172
wrapMode: Text.WordWrap
173
width: _carouselThumb.width
174
horizontalAlignment: Text.AlignHCenter
180
onClicked: _detailCarousel.thumbClicked(model)