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

@ -87,7 +87,7 @@ void DanbooruService::getPostList(int page, QStringList tags, int limit)
QUrl danbooruUrl = requestUrl(m_url, POST_URL, m_username,
m_password, parameters, tags);
//qDebug() << "Final constructed post URL" << danbooruUrl.url();
// qDebug() << "Final constructed post URL" << danbooruUrl.url();
KIO::StoredTransferJob* job = KIO::storedGet(danbooruUrl, KIO::NoReload,
KIO::HideProgressInfo);
@ -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,18 +335,13 @@ 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
m_currentPosts--;
delete post;
continue;
for (auto tag: post->tags()) {
if (m_blacklist.contains(tag)) {
m_currentPosts--;
delete post;
continue;
}
}
QPixmap pix;