Add a sampleUrl function to get back the sample url of an image

The sample url is a mid-scaled version of the image, used for
previewing.
This commit is contained in:
Luca Beltrame 2015-02-26 00:20:21 +01:00
parent 4cf88931b5
commit a11bc79309
2 changed files with 17 additions and 4 deletions

View file

@ -60,10 +60,11 @@ DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
m_height = postData.value("height").toString().toInt();
m_width = postData.value("width").toString().toInt();
m_url = QUrl(postData.value("file_url").toUrl());
m_thumbnailUrl = QUrl(postData.value("preview_url").toUrl());
m_url = postData.value("file_url").toUrl();
m_thumbnailUrl = postData.value("preview_url").toUrl();
m_size = postData.value("file_size").toInt();
m_rating = RATING_MAP.value(postData.value("rating").toString());
m_sampleUrl = postData.value("sample_url").toUrl();
}
@ -77,8 +78,10 @@ DanbooruPost::DanbooruPost(QXmlStreamAttributes &postData, QPixmap pixmap, QObje
m_height = postData.value("height").toString().toInt();
m_width = postData.value("width").toString().toInt();
m_url = QUrl(postData.value("file_url").toString());
m_thumbnailUrl = QUrl(postData.value("preview_url").toString());
m_url = QUrl::fromUserInput(postData.value("file_url").toString());
m_thumbnailUrl = QUrl::fromUserInput(postData.value("preview_url").toString());
m_sampleUrl = QUrl::fromUserInput(postData.value("sample_url").toString());
m_size = postData.value("file_size").toString().toInt();
m_rating = RATING_MAP.value(postData.value("rating").toString());
}
@ -141,6 +144,12 @@ const QUrl DanbooruPost::thumbnailUrl() const
return m_thumbnailUrl;
}
const QUrl DanbooruPost::sampleUrl() const
{
return m_sampleUrl;
}
QPixmap DanbooruPost::pixmap() const
{
return m_pixmap;