Don't create a temporary QSet to check the blacklist

This commit is contained in:
Luca Beltrame 2014-10-04 11:07:41 +02:00
parent 08b32208f0
commit 8545ad84a8

View file

@ -283,7 +283,7 @@ const DanbooruPost::Ratings DanbooruService::maximumAllowedRating() const
void DanbooruService::processPostList(KJob* job)
{
////qDebug() << "Got post data OK";
// qDebug() << "Got post data OK";
if (job->error()) {
Q_EMIT(downloadError(job->errorString()));
@ -335,19 +335,14 @@ void DanbooruService::processPostList(KJob* job)
}
// second check, blacklist
// We make a copy due to the fact that otherwise intersect()
// will change the set in place
QSet<QString> temp = m_blacklist;
temp = temp.intersect(post->tags());
if (!temp.isEmpty()) {
// Blacklisted tags are present, do not use this post
for (auto tag: post->tags()) {
if (m_blacklist.contains(tag)) {
m_currentPosts--;
delete post;
continue;
}
}
QPixmap pix;
// QPixmap* pix = new QPixmap();