Don't create a temporary QSet to check the blacklist
This commit is contained in:
		
					parent
					
						
							
								08b32208f0
							
						
					
				
			
			
				commit
				
					
						8545ad84a8
					
				
			
		
					 1 changed files with 8 additions and 13 deletions
				
			
		| 
						 | 
				
			
			@ -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,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();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue