-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtraktseason.cpp
161 lines (132 loc) · 2.87 KB
/
traktseason.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#include "traktseason.h"
#include <QVariantMap>
#include "traktshow.h"
TraktSeason::TraktSeason(TraktShow *show) :
TraktItem(show),
m_number(0),
m_rating(0),
m_votes(0),
m_episodeCount(0),
m_airedEpisodes(0),
m_show(show)
{
}
TraktSeason::TraktSeason(const QVariantMap &data, TraktShow *show) :
TraktItem(show),
m_rating(0),
m_votes(0),
m_episodeCount(0),
m_airedEpisodes(0),
m_show(show)
{
m_ids = new TraktIds(data.value("ids").toMap(), "seasons", this);
m_number = data.value("number").toInt();
m_images = new TraktImageSet(data.value("images").toMap(), this);
}
int TraktSeason::number() const
{
return m_number;
}
void TraktSeason::setNumber(int number)
{
m_number = number;
emit numberChanged();
emit titleChanged();
}
double TraktSeason::rating() const
{
return m_rating;
}
void TraktSeason::setRating(double rating)
{
m_rating = rating;
emit ratingChanged();
}
int TraktSeason::votes() const
{
return m_votes;
}
void TraktSeason::setVotes(int votes)
{
m_votes = votes;
emit votesChanged();
}
int TraktSeason::episodeCount() const
{
return m_episodeCount;
}
void TraktSeason::setEpisodeCount(int episodeCount)
{
m_episodeCount = episodeCount;
emit episodeCountChanged();
}
int TraktSeason::airedEpisodes() const
{
return m_airedEpisodes;
}
void TraktSeason::setAiredEpisodes(int airedEpisodes)
{
m_airedEpisodes = airedEpisodes;
emit airedEpisodesChanged();
}
QString TraktSeason::overview() const
{
return m_overview;
}
void TraktSeason::setOverview(const QString &overview)
{
m_overview = overview;
emit overviewChanged();
}
TraktShow *TraktSeason::show() const
{
return m_show;
}
void TraktSeason::setShow(TraktShow *show)
{
if (m_show) {
disconnect(show, 0 , this, 0);
}
m_show = show;
if (m_show) {
connect(show, &TraktShow::imageChanged, this, &TraktItem::imageChanged);
}
setParent(show);
emit showChanged();
}
QString TraktSeason::title() const
{
//: Title of the season details page
//% "Season %1"
return qtTrId("season-title").arg(QString::number(m_number));
}
void TraktSeason::setTitle(const QString &title)
{
Q_UNUSED(title)
}
TraktImages *TraktSeason::image() const
{
if (m_images->poster()) {
return m_images->poster();
} else if (m_show) {
return m_show->image();
}
return 0;
}
void TraktSeason::parse(const QVariantMap &data)
{
setNumber(data.value("number").toInt());
setRating(data.value("rating").toDouble());
setVotes(data.value("votes").toInt());
setEpisodeCount(data.value("episode_count").toInt());
setAiredEpisodes(data.value("aired_episodes").toInt());
setOverview(data.value("overview").toString());
setLoaded(true);
}
void TraktSeason::load()
{
}
QString TraktSeason::itemUrl() const
{
return QString();
}