From 80b9bfaf196410f35cea05abcf65368d0e46c94b Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Wed, 17 Sep 2014 22:15:02 +0100 Subject: [PATCH] C++11ify AclRegistryImpl --- src/tomahawk/AclRegistryImpl.cpp | 11 ++++++----- src/tomahawk/AclRegistryImpl.h | 23 +++++++++-------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/tomahawk/AclRegistryImpl.cpp b/src/tomahawk/AclRegistryImpl.cpp index 93719929b..8c4f74775 100644 --- a/src/tomahawk/AclRegistryImpl.cpp +++ b/src/tomahawk/AclRegistryImpl.cpp @@ -146,7 +146,7 @@ ACLRegistryImpl::getUserDecision( ACLRegistry::User user, const QString &usernam tDebug( LOGVERBOSE ) << Q_FUNC_INFO; ACLJobItem* job = new ACLJobItem( user, username ); - m_jobQueue.enqueue( job ); + m_jobQueue.push( job ); QTimer::singleShot( 0, this, SLOT( queueNextJob() ) ); } @@ -163,7 +163,7 @@ ACLRegistryImpl::userDecision( ACLRegistry::User user ) emit aclResult( user.knownDbids.first(), user.knownAccountIds.first(), user.acl ); m_jobCount--; - if ( !m_jobQueue.isEmpty() ) + if ( !m_jobQueue.empty() ) QTimer::singleShot( 0, this, SLOT( queueNextJob() ) ); } @@ -181,13 +181,14 @@ ACLRegistryImpl::queueNextJob() } tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "jobCount =" << m_jobCount; - tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "jobQueue size =" << m_jobQueue.length(); + tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "jobQueue size =" << m_jobQueue.size(); if ( m_jobCount != 0 ) return; - if ( !m_jobQueue.isEmpty() ) + if ( !m_jobQueue.empty() ) { - ACLJobItem* job = m_jobQueue.dequeue(); + ACLJobItem* job = m_jobQueue.front(); + m_jobQueue.pop(); ACLRegistry::User user = job->user(); bool found = false; foreach( QString dbid, user.knownDbids ) diff --git a/src/tomahawk/AclRegistryImpl.h b/src/tomahawk/AclRegistryImpl.h index f080fec69..c07378620 100644 --- a/src/tomahawk/AclRegistryImpl.h +++ b/src/tomahawk/AclRegistryImpl.h @@ -23,15 +23,7 @@ #include "network/acl/AclRegistry.h" #include "HeadlessCheck.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include class ACLJobItem; @@ -53,12 +45,15 @@ public slots: * @param username If not empty, will store the given username along with the new ACL value. Defaults to QString(). * @return Tomahawk::ACLStatus::Type **/ - virtual Tomahawk::ACLStatus::Type isAuthorizedUser( const QString &dbid, const QString &username, Tomahawk::ACLStatus::Type globalType = Tomahawk::ACLStatus::NotFound, bool skipEmission = false ); - virtual void wipeEntries(); + Tomahawk::ACLStatus::Type isAuthorizedUser( const QString &dbid, + const QString &username, + Tomahawk::ACLStatus::Type globalType = Tomahawk::ACLStatus::NotFound, + bool skipEmission = false ) override; + void wipeEntries() override; protected: - virtual void load(); - virtual void save(); + void load() override; + void save() override; void getUserDecision( ACLRegistry::User user, const QString &username ); @@ -67,7 +62,7 @@ private slots: void queueNextJob(); private: - QQueue< ACLJobItem* > m_jobQueue; + std::queue< ACLJobItem* > m_jobQueue; int m_jobCount; };