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
				
			
		| 
						 | 
				
			
			@ -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