From 5bf09cced0c74645d9e653b11264e892ee466e86 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Sat, 15 Jun 2013 22:01:20 +0200 Subject: [PATCH] Rename Tomahawk::ACL -> Tomahawk::ACLStatus --- src/libtomahawk/AclRegistry.cpp | 4 ++-- src/libtomahawk/AclRegistry.h | 12 +++++------ src/libtomahawk/Typedefs.h | 4 ++-- src/libtomahawk/jobview/AclJobItem.cpp | 6 +++--- src/libtomahawk/jobview/AclJobItem.h | 4 ++-- src/libtomahawk/jobview/JobStatusView.cpp | 2 +- src/libtomahawk/network/Connection.cpp | 12 +++++------ src/libtomahawk/network/Connection.h | 2 +- src/libtomahawk/network/Servent.cpp | 8 +++---- src/libtomahawk/network/Servent.h | 2 +- src/tomahawk/AclRegistryImpl.cpp | 26 +++++++++++------------ src/tomahawk/AclRegistryImpl.h | 4 ++-- 12 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/libtomahawk/AclRegistry.cpp b/src/libtomahawk/AclRegistry.cpp index 6c6486feb..18390b400 100644 --- a/src/libtomahawk/AclRegistry.cpp +++ b/src/libtomahawk/AclRegistry.cpp @@ -66,7 +66,7 @@ QDataStream& operator>>( QDataStream &in, ACLRegistry::User &user ) } int aclIn; in >> aclIn; - user.acl = (Tomahawk::ACL::Type)( aclIn ); + user.acl = (Tomahawk::ACLStatus::Type)( aclIn ); } return in; } @@ -91,7 +91,7 @@ ACLRegistry::setInstance( ACLRegistry* instance ) ACLRegistry::ACLRegistry( QObject* parent ) : QObject( parent ) { - qRegisterMetaType< Tomahawk::ACL::Type >( "Tomahawk::ACL::Type" ); + qRegisterMetaType< Tomahawk::ACLStatus::Type >( "Tomahawk::ACLStatus::Type" ); qRegisterMetaType< ACLRegistry::User >( "ACLRegistry::User" ); qRegisterMetaTypeStreamOperators< ACLRegistry::User >( "ACLRegistry::User" ); } diff --git a/src/libtomahawk/AclRegistry.h b/src/libtomahawk/AclRegistry.h index 80aee719a..6df255fd8 100644 --- a/src/libtomahawk/AclRegistry.h +++ b/src/libtomahawk/AclRegistry.h @@ -49,20 +49,20 @@ public: QString friendlyName; QStringList knownDbids; QStringList knownAccountIds; - Tomahawk::ACL::Type acl; + Tomahawk::ACLStatus::Type acl; User() : uuid( QUuid::createUuid().toString() ) , friendlyName() , knownDbids() , knownAccountIds() - , acl( Tomahawk::ACL::NotFound ) + , acl( Tomahawk::ACLStatus::NotFound ) {} ~User() {} - User( QString p_uuid, QString p_friendlyName, QStringList p_knownDbids, QStringList p_knownAccountIds, Tomahawk::ACL::Type p_acl ) + User( QString p_uuid, QString p_friendlyName, QStringList p_knownDbids, QStringList p_knownAccountIds, Tomahawk::ACLStatus::Type p_acl ) : uuid( p_uuid ) , friendlyName( p_friendlyName ) , knownDbids( p_knownDbids ) @@ -83,7 +83,7 @@ public: virtual ~ACLRegistry(); signals: - void aclResult( QString nodeid, QString username, Tomahawk::ACL::Type peerStatus ); + void aclResult( QString nodeid, QString username, Tomahawk::ACLStatus::Type peerStatus ); public slots: /** @@ -92,9 +92,9 @@ public slots: * @param dbid DBID of peer * @param globalType Global ACL to store if peer not found; if ACLRegistry::NotFound, does not store the peer Defaults to ACLRegistry::NotFound. * @param username If not empty, will store the given username along with the new ACL value. Defaults to QString(). - * @return Tomahawk::ACL::Type + * @return Tomahawk::ACLStatus::Type **/ - virtual Tomahawk::ACL::Type isAuthorizedUser( const QString &dbid, const QString &username, Tomahawk::ACL::Type globalType = Tomahawk::ACL::NotFound, bool skipEmission = false ) = 0; + virtual Tomahawk::ACLStatus::Type isAuthorizedUser( const QString &dbid, const QString &username, Tomahawk::ACLStatus::Type globalType = Tomahawk::ACLStatus::NotFound, bool skipEmission = false ) = 0; virtual void wipeEntries(); protected: diff --git a/src/libtomahawk/Typedefs.h b/src/libtomahawk/Typedefs.h index 94d2fa1d0..1a96df823 100644 --- a/src/libtomahawk/Typedefs.h +++ b/src/libtomahawk/Typedefs.h @@ -80,7 +80,7 @@ namespace Tomahawk typedef QString QID; //query id typedef QString RID; //result id - namespace ACL { + namespace ACLStatus { enum Type { NotFound = 0, Deny = 1, @@ -260,6 +260,6 @@ inline static QString uuid() Q_DECLARE_METATYPE( QModelIndex ) Q_DECLARE_METATYPE( QPersistentModelIndex ) Q_DECLARE_METATYPE( QNetworkReply* ) -Q_DECLARE_METATYPE( Tomahawk::ACL::Type ) +Q_DECLARE_METATYPE( Tomahawk::ACLStatus::Type ) #endif // TYPEDEFS_H diff --git a/src/libtomahawk/jobview/AclJobItem.cpp b/src/libtomahawk/jobview/AclJobItem.cpp index 48be2ab18..7ffdb58eb 100644 --- a/src/libtomahawk/jobview/AclJobItem.cpp +++ b/src/libtomahawk/jobview/AclJobItem.cpp @@ -146,9 +146,9 @@ ACLJobDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QSt { QMouseEvent* me = static_cast< QMouseEvent* >( event ); if ( m_savedAcceptRect.contains( me->pos() ) ) - emit aclResult( Tomahawk::ACL::Stream ); + emit aclResult( Tomahawk::ACLStatus::Stream ); else if ( m_savedDenyRect.contains( me->pos() ) ) - emit aclResult( Tomahawk::ACL::Deny ); + emit aclResult( Tomahawk::ACLStatus::Deny ); return true; } @@ -195,7 +195,7 @@ ACLJobDelegate::emitSizeHintChanged( const QModelIndex& index ) void -ACLJobItem::aclResult( Tomahawk::ACL::Type result ) +ACLJobItem::aclResult( Tomahawk::ACLStatus::Type result ) { tLog() << Q_FUNC_INFO; m_user.acl = result; diff --git a/src/libtomahawk/jobview/AclJobItem.h b/src/libtomahawk/jobview/AclJobItem.h index d1476fbc0..53508f300 100644 --- a/src/libtomahawk/jobview/AclJobItem.h +++ b/src/libtomahawk/jobview/AclJobItem.h @@ -43,7 +43,7 @@ public: signals: void update( const QModelIndex& idx ); - void aclResult( Tomahawk::ACL::Type result ); + void aclResult( Tomahawk::ACLStatus::Type result ); protected: virtual bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index ); @@ -84,7 +84,7 @@ signals: void userDecision( ACLRegistry::User user ); public slots: - void aclResult( Tomahawk::ACL::Type result ); + void aclResult( Tomahawk::ACLStatus::Type result ); private: QStyledItemDelegate* m_delegate; diff --git a/src/libtomahawk/jobview/JobStatusView.cpp b/src/libtomahawk/jobview/JobStatusView.cpp index afead13f8..3efe690ed 100644 --- a/src/libtomahawk/jobview/JobStatusView.cpp +++ b/src/libtomahawk/jobview/JobStatusView.cpp @@ -104,7 +104,7 @@ JobStatusView::customDelegateJobInserted( int row, JobStatusItem* item ) if ( delegate ) { connect( delegate, SIGNAL( update( const QModelIndex& ) ), m_view, SLOT( update( const QModelIndex & ) ) ); - connect( delegate, SIGNAL( aclResult( Tomahawk::ACL::Type ) ), item, SLOT( aclResult( Tomahawk::ACL::Type ) ) ); + connect( delegate, SIGNAL( aclResult( Tomahawk::ACLStatus::Type ) ), item, SLOT( aclResult( Tomahawk::ACLStatus::Type ) ) ); delegate->emitSizeHintChanged( m_model->index( row, 0 ) ); } else diff --git a/src/libtomahawk/network/Connection.cpp b/src/libtomahawk/network/Connection.cpp index a2de13aae..3366d6640 100644 --- a/src/libtomahawk/network/Connection.cpp +++ b/src/libtomahawk/network/Connection.cpp @@ -317,10 +317,10 @@ Connection::checkACL() } tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking ACL for" << name(); - connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACL::Type ) ), - this, SLOT( checkACLResult( QString, QString, Tomahawk::ACL::Type ) ), + connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACLStatus::Type ) ), + this, SLOT( checkACLResult( QString, QString, Tomahawk::ACLStatus::Type ) ), Qt::QueuedConnection ); - QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, d_func()->nodeid ), Q_ARG( QString, bareName() ), Q_ARG( Tomahawk::ACL::Type, Tomahawk::ACL::NotFound ) ); + QMetaObject::invokeMethod( ACLRegistry::instance(), "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( QString, d_func()->nodeid ), Q_ARG( QString, bareName() ), Q_ARG( Tomahawk::ACLStatus::Type, Tomahawk::ACLStatus::NotFound ) ); } @@ -331,7 +331,7 @@ Connection::bareName() const } void -Connection::checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACL::Type peerStatus ) +Connection::checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACLStatus::Type peerStatus ) { if ( nodeid != d_func()->nodeid ) { @@ -344,9 +344,9 @@ Connection::checkACLResult( const QString &nodeid, const QString &username, Toma return; } - disconnect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACL::Type ) ) ); + disconnect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACLStatus::Type ) ) ); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QString( "ACL status for user %1 is" ).arg( username ) << peerStatus; - if ( peerStatus == Tomahawk::ACL::Stream ) + if ( peerStatus == Tomahawk::ACLStatus::Stream ) { QTimer::singleShot( 0, this, SLOT( doSetup() ) ); return; diff --git a/src/libtomahawk/network/Connection.h b/src/libtomahawk/network/Connection.h index c9be81ec6..de9bb155e 100644 --- a/src/libtomahawk/network/Connection.h +++ b/src/libtomahawk/network/Connection.h @@ -116,7 +116,7 @@ private slots: void readyRead(); void doSetup(); void checkACL(); - void checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACL::Type peerStatus ); + void checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACLStatus::Type peerStatus ); void bytesWritten( qint64 ); void calcStats(); diff --git a/src/libtomahawk/network/Servent.cpp b/src/libtomahawk/network/Servent.cpp index 47b1c4336..801aaae90 100644 --- a/src/libtomahawk/network/Servent.cpp +++ b/src/libtomahawk/network/Servent.cpp @@ -211,8 +211,8 @@ Servent::startListening( QHostAddress ha, bool upnp, int port ) break; } - connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACL::Type ) ), - this, SLOT( checkACLResult( QString, QString, Tomahawk::ACL::Type ) ), + connect( ACLRegistry::instance(), SIGNAL( aclResult( QString, QString, Tomahawk::ACLStatus::Type ) ), + this, SLOT( checkACLResult( QString, QString, Tomahawk::ACLStatus::Type ) ), Qt::QueuedConnection ); return true; @@ -917,7 +917,7 @@ Servent::socketError( QAbstractSocket::SocketError e ) void -Servent::checkACLResult( const QString& nodeid, const QString& username, Tomahawk::ACL::Type peerStatus ) +Servent::checkACLResult( const QString& nodeid, const QString& username, Tomahawk::ACLStatus::Type peerStatus ) { if ( !d_func()->queuedForACLResult.contains( username ) ) @@ -931,7 +931,7 @@ Servent::checkACLResult( const QString& nodeid, const QString& username, Tomahaw tDebug( LOGVERBOSE ) << Q_FUNC_INFO << QString( "ACL status for user %1 is" ).arg( username ) << peerStatus; QSet peerInfos = d_func()->queuedForACLResult.value( username ).value( nodeid ); - if ( peerStatus == Tomahawk::ACL::Stream ) + if ( peerStatus == Tomahawk::ACLStatus::Stream ) { foreach ( Tomahawk::peerinfo_ptr peerInfo, peerInfos ) { diff --git a/src/libtomahawk/network/Servent.h b/src/libtomahawk/network/Servent.h index 53e20c415..e713b5d1b 100644 --- a/src/libtomahawk/network/Servent.h +++ b/src/libtomahawk/network/Servent.h @@ -168,7 +168,7 @@ private slots: void deleteLazyOffer( const QString& key ); void readyRead(); void socketError( QAbstractSocket::SocketError e ); - void checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACL::Type peerStatus ); + void checkACLResult( const QString &nodeid, const QString &username, Tomahawk::ACLStatus::Type peerStatus ); Connection* claimOffer( ControlConnection* cc, const QString &nodeid, const QString &key, const QHostAddress peer = QHostAddress::Any ); diff --git a/src/tomahawk/AclRegistryImpl.cpp b/src/tomahawk/AclRegistryImpl.cpp index 6dfd09bd5..8b95241f5 100644 --- a/src/tomahawk/AclRegistryImpl.cpp +++ b/src/tomahawk/AclRegistryImpl.cpp @@ -53,14 +53,14 @@ ACLRegistryImpl::~ACLRegistryImpl() } -Tomahawk::ACL::Type -ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, Tomahawk::ACL::Type globalType, bool skipEmission ) +Tomahawk::ACLStatus::Type +ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, Tomahawk::ACLStatus::Type globalType, bool skipEmission ) { if ( QThread::currentThread() != TOMAHAWK_APPLICATION::instance()->thread() ) { if ( !skipEmission ) - QMetaObject::invokeMethod( this, "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( const QString&, dbid ), Q_ARG( const QString &, username ), Q_ARG( Tomahawk::ACL::Type, globalType ), Q_ARG( bool, skipEmission ) ); - return Tomahawk::ACL::NotFound; + QMetaObject::invokeMethod( this, "isAuthorizedUser", Qt::QueuedConnection, Q_ARG( const QString&, dbid ), Q_ARG( const QString &, username ), Q_ARG( Tomahawk::ACLStatus::Type, globalType ), Q_ARG( bool, skipEmission ) ); + return Tomahawk::ACLStatus::NotFound; } #ifndef ENABLE_HEADLESS @@ -77,8 +77,8 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, if ( account->accountFriendlyName() == username ) { if ( !skipEmission ) - emit aclResult( dbid, username, Tomahawk::ACL::Stream ); - return Tomahawk::ACL::Stream; + emit aclResult( dbid, username, Tomahawk::ACLStatus::Stream ); + return Tomahawk::ACLStatus::Stream; } } } @@ -119,24 +119,24 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, } if ( skipEmission ) - return Tomahawk::ACL::NotFound; + return Tomahawk::ACLStatus::NotFound; // User was not found, create a new user entry ACLRegistry::User user; user.knownDbids.append( dbid ); user.knownAccountIds.append( username ); - if ( globalType != Tomahawk::ACL::NotFound ) + if ( globalType != Tomahawk::ACLStatus::NotFound ) user.acl = globalType; #ifdef ENABLE_HEADLESS - user.acl = Tomahawk::ACL::Stream; + user.acl = Tomahawk::ACLStatus::Stream; #else if ( !TomahawkUtils::headless() ) { getUserDecision( user, username ); - return Tomahawk::ACL::NotFound; + return Tomahawk::ACLStatus::NotFound; } else - user.acl = Tomahawk::ACL::Stream; + user.acl = Tomahawk::ACLStatus::Stream; #endif m_cache.append( user ); save(); @@ -200,8 +200,8 @@ ACLRegistryImpl::queueNextJob() bool found = false; foreach( QString dbid, user.knownDbids ) { - Tomahawk::ACL::Type acl = isAuthorizedUser( dbid, job->username(), Tomahawk::ACL::NotFound, true ); - if ( acl != Tomahawk::ACL::NotFound ) + Tomahawk::ACLStatus::Type acl = isAuthorizedUser( dbid, job->username(), Tomahawk::ACLStatus::NotFound, true ); + if ( acl != Tomahawk::ACLStatus::NotFound ) { tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Found existing acl entry for =" << user.knownAccountIds.first(); found = true; diff --git a/src/tomahawk/AclRegistryImpl.h b/src/tomahawk/AclRegistryImpl.h index fae57c210..c1bb3b8aa 100644 --- a/src/tomahawk/AclRegistryImpl.h +++ b/src/tomahawk/AclRegistryImpl.h @@ -51,9 +51,9 @@ public slots: * @param dbid DBID of peer * @param globalType Global ACL to store if peer not found; if ACLRegistry::NotFound, does not store the peer Defaults to ACLRegistry::NotFound. * @param username If not empty, will store the given username along with the new ACL value. Defaults to QString(). - * @return Tomahawk::ACL::Type + * @return Tomahawk::ACLStatus::Type **/ - virtual Tomahawk::ACL::Type isAuthorizedUser( const QString &dbid, const QString &username, Tomahawk::ACL::Type globalType = Tomahawk::ACL::NotFound, bool skipEmission = false ); + virtual Tomahawk::ACLStatus::Type isAuthorizedUser( const QString &dbid, const QString &username, Tomahawk::ACLStatus::Type globalType = Tomahawk::ACLStatus::NotFound, bool skipEmission = false ); virtual void wipeEntries(); protected: