mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 23:57:34 +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;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
|
||||||
ACLJobItem* job = new ACLJobItem( user, username );
|
ACLJobItem* job = new ACLJobItem( user, username );
|
||||||
m_jobQueue.enqueue( job );
|
m_jobQueue.push( job );
|
||||||
QTimer::singleShot( 0, this, SLOT( queueNextJob() ) );
|
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 );
|
emit aclResult( user.knownDbids.first(), user.knownAccountIds.first(), user.acl );
|
||||||
|
|
||||||
m_jobCount--;
|
m_jobCount--;
|
||||||
if ( !m_jobQueue.isEmpty() )
|
if ( !m_jobQueue.empty() )
|
||||||
QTimer::singleShot( 0, this, SLOT( queueNextJob() ) );
|
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 << "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 )
|
if ( m_jobCount != 0 )
|
||||||
return;
|
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();
|
ACLRegistry::User user = job->user();
|
||||||
bool found = false;
|
bool found = false;
|
||||||
foreach( QString dbid, user.knownDbids )
|
foreach( QString dbid, user.knownDbids )
|
||||||
|
@@ -23,15 +23,7 @@
|
|||||||
#include "network/acl/AclRegistry.h"
|
#include "network/acl/AclRegistry.h"
|
||||||
#include "HeadlessCheck.h"
|
#include "HeadlessCheck.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <queue>
|
||||||
#include <QString>
|
|
||||||
#include <QHash>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QMutex>
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QQueue>
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QUuid>
|
|
||||||
|
|
||||||
class ACLJobItem;
|
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().
|
* @param username If not empty, will store the given username along with the new ACL value. Defaults to QString().
|
||||||
* @return Tomahawk::ACLStatus::Type
|
* @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 );
|
Tomahawk::ACLStatus::Type isAuthorizedUser( const QString &dbid,
|
||||||
virtual void wipeEntries();
|
const QString &username,
|
||||||
|
Tomahawk::ACLStatus::Type globalType = Tomahawk::ACLStatus::NotFound,
|
||||||
|
bool skipEmission = false ) override;
|
||||||
|
void wipeEntries() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void load();
|
void load() override;
|
||||||
virtual void save();
|
void save() override;
|
||||||
|
|
||||||
void getUserDecision( ACLRegistry::User user, const QString &username );
|
void getUserDecision( ACLRegistry::User user, const QString &username );
|
||||||
|
|
||||||
@@ -67,7 +62,7 @@ private slots:
|
|||||||
void queueNextJob();
|
void queueNextJob();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QQueue< ACLJobItem* > m_jobQueue;
|
std::queue< ACLJobItem* > m_jobQueue;
|
||||||
int m_jobCount;
|
int m_jobCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user