mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
C++11ify AclRegistryImpl
This commit is contained in:
@@ -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 )
|
||||
|
@@ -23,15 +23,7 @@
|
||||
#include "network/acl/AclRegistry.h"
|
||||
#include "HeadlessCheck.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QHash>
|
||||
#include <QTimer>
|
||||
#include <QMutex>
|
||||
#include <QVariant>
|
||||
#include <QQueue>
|
||||
#include <QStringList>
|
||||
#include <QUuid>
|
||||
#include <queue>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user