[libdanbooru/danbooruservice] Fixup types and flags
This commit is contained in:
parent
324bacda52
commit
ce6a1cbcff
2 changed files with 17 additions and 16 deletions
|
@ -235,15 +235,15 @@ const QStringList DanbooruService::allowedRatings() const
|
|||
{
|
||||
QStringList ratings;
|
||||
|
||||
if (m_maxRating.testFlag(Safe)) {
|
||||
if (m_maxRating.testFlag(DanbooruPost::Safe)) {
|
||||
ratings.append("Safe");
|
||||
}
|
||||
|
||||
if (m_maxRating.testFlag(Questionable)) {
|
||||
if (m_maxRating.testFlag(DanbooruPost::Questionable)) {
|
||||
ratings.append("Questionable");
|
||||
}
|
||||
|
||||
if (m_maxRating.testFlag(Explicit)) {
|
||||
if (m_maxRating.testFlag(DanbooruPost::Explicit)) {
|
||||
ratings.append("Explicit");
|
||||
}
|
||||
|
||||
|
@ -251,9 +251,9 @@ const QStringList DanbooruService::allowedRatings() const
|
|||
|
||||
}
|
||||
|
||||
void DanbooruService::setMaximumAllowedRating(const DanbooruPost::Rating& rating)
|
||||
void DanbooruService::setMaximumAllowedRating(DanbooruPost::Rating rating)
|
||||
{
|
||||
DanbooruPost::Rating flags;
|
||||
DanbooruPost::Ratings flags;
|
||||
|
||||
switch (rating) {
|
||||
case DanbooruPost::Safe:
|
||||
|
@ -271,7 +271,7 @@ void DanbooruService::setMaximumAllowedRating(const DanbooruPost::Rating& rating
|
|||
|
||||
}
|
||||
|
||||
const Ratings DanbooruService::maximumAllowedRating() const
|
||||
const DanbooruPost::Ratings DanbooruService::maximumAllowedRating() const
|
||||
{
|
||||
|
||||
return m_maxRating;
|
||||
|
@ -349,12 +349,13 @@ void DanbooruService::processPostList(KJob* job)
|
|||
continue;
|
||||
}
|
||||
|
||||
QPixmap* pix = new QPixmap();
|
||||
QPixmap pix;
|
||||
// QPixmap* pix = new QPixmap();
|
||||
bool result;
|
||||
|
||||
if (m_cache) {
|
||||
result = m_cache->findPixmap(post->thumbnailUrl().url(),
|
||||
pix);
|
||||
&pix);
|
||||
} else {
|
||||
result = false;
|
||||
}
|
||||
|
@ -375,7 +376,6 @@ void DanbooruService::processPostList(KJob* job)
|
|||
|
||||
} else {
|
||||
|
||||
delete pix;
|
||||
|
||||
StoredTransferJob* pixmapJob = KIO::storedGet(
|
||||
post->thumbnailUrl(),
|
||||
|
@ -544,7 +544,8 @@ void DanbooruService::downloadThumbnail(KJob* job)
|
|||
QVariant postData = job->property("danbooruPost");
|
||||
|
||||
DanbooruPost* post = postData.value<DanbooruPost*>();
|
||||
QPixmap* pix = new QPixmap();
|
||||
QPixmap pix;
|
||||
// QPixmap* pix = new QPixmap();
|
||||
|
||||
StoredTransferJob* jobResult = qobject_cast<StoredTransferJob*>(job);
|
||||
|
||||
|
@ -554,7 +555,7 @@ void DanbooruService::downloadThumbnail(KJob* job)
|
|||
|
||||
}
|
||||
|
||||
bool ok = pix->loadFromData(jobResult->data());
|
||||
bool ok = pix.loadFromData(jobResult->data());
|
||||
|
||||
if (!ok) {
|
||||
Q_EMIT(downloadError(QString("Pixmap data could not be loaded")));
|
||||
|
@ -565,7 +566,7 @@ void DanbooruService::downloadThumbnail(KJob* job)
|
|||
|
||||
if (m_cache) {
|
||||
//qDebug() << "Inserting item in cache";
|
||||
m_cache->insertPixmap(post->thumbnailUrl().url(), *pix);
|
||||
m_cache->insertPixmap(post->thumbnailUrl().url(), pix);
|
||||
}
|
||||
|
||||
m_currentPosts--; // One less post to do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue