Skip to content

Commit 3fc65de

Browse files
committed
season: use poster as fallback for item.image
1 parent 4a12a41 commit 3fc65de

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

traktseason.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,16 @@ TraktShow *TraktSeason::show() const
102102

103103
void TraktSeason::setShow(TraktShow *show)
104104
{
105+
if (m_show) {
106+
disconnect(show, 0 , this, 0);
107+
}
108+
105109
m_show = show;
110+
111+
if (m_show) {
112+
connect(show, &TraktShow::imageChanged, this, &TraktItem::imageChanged);
113+
}
114+
106115
setParent(show);
107116
emit showChanged();
108117
}
@@ -117,6 +126,17 @@ void TraktSeason::setTitle(const QString &title)
117126
Q_UNUSED(title)
118127
}
119128

129+
TraktImages *TraktSeason::image() const
130+
{
131+
if (m_images->poster()) {
132+
return m_images->poster();
133+
} else if (m_show) {
134+
return m_show->image();
135+
}
136+
137+
return 0;
138+
}
139+
120140
void TraktSeason::parse(const QVariantMap &data)
121141
{
122142
setNumber(data.value("number").toInt());

traktseason.h

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class TraktSeason : public TraktItem
4545
QString title() const Q_DECL_OVERRIDE;
4646
void setTitle(const QString &title) Q_DECL_OVERRIDE;
4747

48+
virtual TraktImages *image() const Q_DECL_OVERRIDE;
49+
4850
void parse(const QVariantMap &data) Q_DECL_OVERRIDE;
4951
void load() Q_DECL_OVERRIDE;
5052

0 commit comments

Comments
 (0)