1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

* Style and logging clean-ups.

This commit is contained in:
Christian Muehlhaeuser
2012-11-09 05:59:22 +01:00
parent 6ceb13dcc5
commit f82b81e001
8 changed files with 137 additions and 110 deletions

View File

@@ -56,7 +56,6 @@ ACLRegistryImpl::~ACLRegistryImpl()
ACLRegistry::ACL ACLRegistry::ACL
ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, ACLRegistry::ACL globalType, bool skipEmission ) ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, ACLRegistry::ACL globalType, bool skipEmission )
{ {
tLog() << Q_FUNC_INFO;
if ( QThread::currentThread() != TOMAHAWK_APPLICATION::instance()->thread() ) if ( QThread::currentThread() != TOMAHAWK_APPLICATION::instance()->thread() )
{ {
if ( !skipEmission ) if ( !skipEmission )
@@ -153,7 +152,7 @@ ACLRegistryImpl::getUserDecision( ACLRegistry::User user, const QString &usernam
if ( TomahawkUtils::headless() ) if ( TomahawkUtils::headless() )
return; return;
tLog() << 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.enqueue( job );
QTimer::singleShot( 0, this, SLOT( queueNextJob() ) ); QTimer::singleShot( 0, this, SLOT( queueNextJob() ) );
@@ -166,7 +165,7 @@ ACLRegistryImpl::userDecision( ACLRegistry::User user )
if ( TomahawkUtils::headless() ) if ( TomahawkUtils::headless() )
return; return;
tLog() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
m_cache.append( user ); m_cache.append( user );
save(); save();
emit aclResult( user.knownDbids.first(), user.knownAccountIds.first(), user.acl ); emit aclResult( user.knownDbids.first(), user.knownAccountIds.first(), user.acl );
@@ -188,8 +187,9 @@ ACLRegistryImpl::queueNextJob()
QMetaObject::invokeMethod( this, "queueNextJob", Qt::QueuedConnection ); QMetaObject::invokeMethod( this, "queueNextJob", Qt::QueuedConnection );
return; return;
} }
tLog() << Q_FUNC_INFO << "jobCount =" << m_jobCount;
tLog() << Q_FUNC_INFO << "jobQueue size =" << m_jobQueue.length(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "jobCount =" << m_jobCount;
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "jobQueue size =" << m_jobQueue.length();
if ( m_jobCount != 0 ) if ( m_jobCount != 0 )
return; return;
@@ -203,21 +203,21 @@ ACLRegistryImpl::queueNextJob()
ACLRegistry::ACL acl = isAuthorizedUser( dbid, job->username(), ACLRegistry::NotFound, true ); ACLRegistry::ACL acl = isAuthorizedUser( dbid, job->username(), ACLRegistry::NotFound, true );
if ( acl != ACLRegistry::NotFound ) if ( acl != ACLRegistry::NotFound )
{ {
tLog() << Q_FUNC_INFO << "Found existing acl entry for =" << user.knownAccountIds.first(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Found existing acl entry for =" << user.knownAccountIds.first();
found = true; found = true;
break; break;
} }
} }
if ( found ) if ( found )
{ {
tLog() << Q_FUNC_INFO << "deleting job, already have ACL for" << user.knownAccountIds.first(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "deleting job, already have ACL for" << user.knownAccountIds.first();
delete job; delete job;
QTimer::singleShot( 0, this, SLOT( queueNextJob() ) ); QTimer::singleShot( 0, this, SLOT( queueNextJob() ) );
return; return;
} }
else else
{ {
tLog() << Q_FUNC_INFO << "activating job for user" << user.knownAccountIds.first(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "activating job for user" << user.knownAccountIds.first();
m_jobCount++; m_jobCount++;
JobStatusView::instance()->model()->addJob( job ); JobStatusView::instance()->model()->addJob( job );
connect( job, SIGNAL( userDecision( ACLRegistry::User ) ), this, SLOT( userDecision( ACLRegistry::User ) ) ); connect( job, SIGNAL( userDecision( ACLRegistry::User ) ), this, SLOT( userDecision( ACLRegistry::User ) ) );
@@ -238,19 +238,19 @@ ACLRegistryImpl::wipeEntries()
void void
ACLRegistryImpl::load() ACLRegistryImpl::load()
{ {
tLog() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
QVariantList entryList = TomahawkSettings::instance()->aclEntries(); QVariantList entryList = TomahawkSettings::instance()->aclEntries();
foreach ( QVariant entry, entryList ) foreach ( QVariant entry, entryList )
{ {
if ( !entry.isValid() || !entry.canConvert< ACLRegistry::User >() ) if ( !entry.isValid() || !entry.canConvert< ACLRegistry::User >() )
{ {
tLog() << Q_FUNC_INFO << "entry is invalid"; tDebug() << Q_FUNC_INFO << "entry is invalid";
continue; continue;
} }
ACLRegistry::User entryUser = entry.value< ACLRegistry::User >(); ACLRegistry::User entryUser = entry.value< ACLRegistry::User >();
if ( entryUser.knownAccountIds.empty() || entryUser.knownDbids.empty() ) if ( entryUser.knownAccountIds.empty() || entryUser.knownDbids.empty() )
{ {
tLog() << Q_FUNC_INFO << "user known account/dbids is empty"; tDebug() << Q_FUNC_INFO << "user known account/dbids is empty";
continue; continue;
} }
m_cache.append( entryUser ); m_cache.append( entryUser );
@@ -261,11 +261,11 @@ ACLRegistryImpl::load()
void void
ACLRegistryImpl::save() ACLRegistryImpl::save()
{ {
tLog() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
QVariantList entryList; QVariantList entryList;
foreach ( ACLRegistry::User user, m_cache ) foreach ( ACLRegistry::User user, m_cache )
{ {
tLog() << Q_FUNC_INFO << "user is" << user.uuid << "with known name" << user.knownAccountIds.first(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "user is" << user.uuid << "with known name" << user.knownAccountIds.first();
QVariant val = QVariant::fromValue< ACLRegistry::User >( user ); QVariant val = QVariant::fromValue< ACLRegistry::User >( user );
if ( val.isValid() ) if ( val.isValid() )
entryList.append( val ); entryList.append( val );

View File

@@ -24,7 +24,9 @@
using namespace Tomahawk::InfoSystem; using namespace Tomahawk::InfoSystem;
bool newReleaseSort( const InfoStringHash& left, const InfoStringHash& right )
bool
newReleaseSort( const InfoStringHash& left, const InfoStringHash& right )
{ {
if ( !left.contains( "date" ) || !right.contains( "date" ) ) if ( !left.contains( "date" ) || !right.contains( "date" ) )
{ {
@@ -46,15 +48,16 @@ NewReleasesPlugin::NewReleasesPlugin()
m_supportedGetTypes << InfoNewReleaseCapabilities << InfoNewRelease; m_supportedGetTypes << InfoNewReleaseCapabilities << InfoNewRelease;
} }
NewReleasesPlugin::~NewReleasesPlugin() NewReleasesPlugin::~NewReleasesPlugin()
{ {
tDebug ( LOGVERBOSE ) << Q_FUNC_INFO; tDebug ( LOGVERBOSE ) << Q_FUNC_INFO;
} }
void void
NewReleasesPlugin::init() NewReleasesPlugin::init()
{ {
QVariantList source_qvarlist = TomahawkUtils::Cache::instance()->getData( "NewReleasesPlugin", "nr_sources" ).toList(); QVariantList source_qvarlist = TomahawkUtils::Cache::instance()->getData( "NewReleasesPlugin", "nr_sources" ).toList();
foreach( const QVariant & source, source_qvarlist ) foreach( const QVariant & source, source_qvarlist )
{ {
@@ -67,13 +70,17 @@ NewReleasesPlugin::init()
fetchNRSourcesList( true ); fetchNRSourcesList( true );
} }
void NewReleasesPlugin::dataError ( InfoRequestData requestData )
void
NewReleasesPlugin::dataError( InfoRequestData requestData )
{ {
emit info ( requestData, QVariant() ); emit info ( requestData, QVariant() );
return; return;
} }
void NewReleasesPlugin::getInfo ( InfoRequestData requestData )
void
NewReleasesPlugin::getInfo( InfoRequestData requestData )
{ {
//qDebug() << Q_FUNC_INFO << requestData.caller; //qDebug() << Q_FUNC_INFO << requestData.caller;
//qDebug() << Q_FUNC_INFO << requestData.customData; //qDebug() << Q_FUNC_INFO << requestData.customData;
@@ -114,12 +121,15 @@ void NewReleasesPlugin::getInfo ( InfoRequestData requestData )
case InfoNewReleaseCapabilities: case InfoNewReleaseCapabilities:
fetchNRCapabilitiesFromCache ( requestData ); fetchNRCapabilitiesFromCache ( requestData );
break; break;
default: default:
dataError ( requestData ); dataError ( requestData );
} }
} }
void NewReleasesPlugin::fetchNRFromCache ( InfoRequestData requestData )
void
NewReleasesPlugin::fetchNRFromCache( InfoRequestData requestData )
{ {
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
{ {
@@ -145,7 +155,9 @@ void NewReleasesPlugin::fetchNRFromCache ( InfoRequestData requestData )
emit getCachedInfo ( criteria, 86400000, requestData ); emit getCachedInfo ( criteria, 86400000, requestData );
} }
void NewReleasesPlugin::fetchNRCapabilitiesFromCache ( InfoRequestData requestData )
void
NewReleasesPlugin::fetchNRCapabilitiesFromCache( InfoRequestData requestData )
{ {
if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() ) if ( !requestData.input.canConvert< Tomahawk::InfoSystem::InfoStringHash >() )
{ {
@@ -160,7 +172,9 @@ void NewReleasesPlugin::fetchNRCapabilitiesFromCache ( InfoRequestData requestDa
emit getCachedInfo ( criteria, 864000000, requestData ); emit getCachedInfo ( criteria, 864000000, requestData );
} }
void NewReleasesPlugin::notInCacheSlot ( InfoStringHash criteria, InfoRequestData requestData )
void
NewReleasesPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requestData )
{ {
switch ( requestData.type ) switch ( requestData.type )
{ {
@@ -190,7 +204,9 @@ void NewReleasesPlugin::notInCacheSlot ( InfoStringHash criteria, InfoRequestDat
} }
} }
void NewReleasesPlugin::fetchNRSourcesList( bool fetchOnlySourcesList )
void
NewReleasesPlugin::fetchNRSourcesList( bool fetchOnlySourcesList )
{ {
QUrl url = QUrl ( QString ( CHART_URL "newreleases" ) ); QUrl url = QUrl ( QString ( CHART_URL "newreleases" ) );
@@ -203,7 +219,9 @@ void NewReleasesPlugin::fetchNRSourcesList( bool fetchOnlySourcesList )
} }
void NewReleasesPlugin::nrSourcesList()
void
NewReleasesPlugin::nrSourcesList()
{ {
tDebug ( LOGVERBOSE ) << "Got newreleases sources list"; tDebug ( LOGVERBOSE ) << "Got newreleases sources list";
QNetworkReply* reply = qobject_cast<QNetworkReply*> ( sender() ); QNetworkReply* reply = qobject_cast<QNetworkReply*> ( sender() );
@@ -232,7 +250,9 @@ void NewReleasesPlugin::nrSourcesList()
} }
} }
void NewReleasesPlugin::fetchAllNRSources()
void
NewReleasesPlugin::fetchAllNRSources()
{ {
if ( !m_nrSources.isEmpty() && m_allNRsMap.isEmpty() ) if ( !m_nrSources.isEmpty() && m_allNRsMap.isEmpty() )
{ {
@@ -251,7 +271,9 @@ void NewReleasesPlugin::fetchAllNRSources()
} }
} }
void NewReleasesPlugin::fetchNR ( InfoRequestData requestData, const QString& source, const QString& nr_id )
void
NewReleasesPlugin::fetchNR( InfoRequestData requestData, const QString& source, const QString& nr_id )
{ {
/// Fetch the chart, we need source and id /// Fetch the chart, we need source and id
QUrl url = QUrl ( QString ( CHART_URL "newreleases/%1/%2" ).arg ( source ).arg ( nr_id ) ); QUrl url = QUrl ( QString ( CHART_URL "newreleases/%1/%2" ).arg ( source ).arg ( nr_id ) );
@@ -263,7 +285,9 @@ void NewReleasesPlugin::fetchNR ( InfoRequestData requestData, const QString& so
connect ( reply, SIGNAL ( finished() ), SLOT ( nrReturned() ) ); connect ( reply, SIGNAL ( finished() ), SLOT ( nrReturned() ) );
} }
void NewReleasesPlugin::nrList()
void
NewReleasesPlugin::nrList()
{ {
tDebug ( LOGVERBOSE ) << "Got newreleases list result"; tDebug ( LOGVERBOSE ) << "Got newreleases list result";
QNetworkReply* reply = qobject_cast<QNetworkReply*> ( sender() ); QNetworkReply* reply = qobject_cast<QNetworkReply*> ( sender() );
@@ -347,7 +371,9 @@ void NewReleasesPlugin::nrList()
QVariantMap defaultMap = m_allNRsMap.value ( "defaults" ).value< QVariantMap >(); QVariantMap defaultMap = m_allNRsMap.value ( "defaults" ).value< QVariantMap >();
m_allNRsMap.insert ( nrName, QVariant::fromValue< QVariantMap > ( newreleases ) ); m_allNRsMap.insert ( nrName, QVariant::fromValue< QVariantMap > ( newreleases ) );
} else { }
else
{
tLog() << "Error fetching charts:" << reply->errorString(); tLog() << "Error fetching charts:" << reply->errorString();
} }
@@ -367,7 +393,9 @@ void NewReleasesPlugin::nrList()
} }
} }
void NewReleasesPlugin::nrReturned()
void
NewReleasesPlugin::nrReturned()
{ {
/// Chart request returned something! Woho /// Chart request returned something! Woho
QNetworkReply* reply = qobject_cast<QNetworkReply*> ( sender() ); QNetworkReply* reply = qobject_cast<QNetworkReply*> ( sender() );
@@ -420,7 +448,8 @@ void NewReleasesPlugin::nrReturned()
criteria[ "nr_id" ] = origData[ "nr_id" ]; criteria[ "nr_id" ] = origData[ "nr_id" ];
criteria[ "nr_source" ] = origData[ "nr_source" ]; criteria[ "nr_source" ] = origData[ "nr_source" ];
emit updateCache( criteria, 86400000, requestData.type, returnedData ); emit updateCache( criteria, 86400000, requestData.type, returnedData );
} else }
else
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Network error in fetching newrelease:" << reply->url().toString(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Network error in fetching newrelease:" << reply->url().toString();
} }

View File

@@ -53,7 +53,7 @@ Database::Database( const QString& dbname, QObject* parent )
else else
m_maxConcurrentThreads = qBound( DEFAULT_WORKER_THREADS, QThread::idealThreadCount(), MAX_WORKER_THREADS ); m_maxConcurrentThreads = qBound( DEFAULT_WORKER_THREADS, QThread::idealThreadCount(), MAX_WORKER_THREADS );
tDebug() << Q_FUNC_INFO << "Using" << m_maxConcurrentThreads << "database worker threads; current (GUI) thread is " << QThread::currentThread(); tDebug() << Q_FUNC_INFO << "Using" << m_maxConcurrentThreads << "database worker threads";
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( indexReady() ) ); connect( m_impl, SIGNAL( indexReady() ), SIGNAL( indexReady() ) );
connect( m_impl, SIGNAL( indexReady() ), SIGNAL( ready() ) ); connect( m_impl, SIGNAL( indexReady() ), SIGNAL( ready() ) );
@@ -75,7 +75,7 @@ Database::Database( const QString& dbname, QObject* parent )
Database::~Database() Database::~Database()
{ {
qDebug() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
m_idWorker->stop(); m_idWorker->stop();
delete m_idWorker; delete m_idWorker;
@@ -120,7 +120,7 @@ void
Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc ) Database::enqueue( const QList< QSharedPointer<DatabaseCommand> >& lc )
{ {
Q_ASSERT( m_ready ); Q_ASSERT( m_ready );
qDebug() << "Enqueueing" << lc.count() << "commands to rw thread"; tDebug( LOGVERBOSE ) << "Enqueueing" << lc.count() << "commands to rw thread";
if ( m_workerRW && m_workerRW.data()->worker() ) if ( m_workerRW && m_workerRW.data()->worker() )
m_workerRW.data()->worker().data()->enqueue( lc ); m_workerRW.data()->worker().data()->enqueue( lc );
} }
@@ -132,7 +132,7 @@ Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
Q_ASSERT( m_ready ); Q_ASSERT( m_ready );
if ( lc->doesMutates() ) if ( lc->doesMutates() )
{ {
qDebug() << "Enqueueing command to rw thread:" << lc->commandname(); tDebug( LOGVERBOSE ) << "Enqueueing command to rw thread:" << lc->commandname();
if ( m_workerRW && m_workerRW.data()->worker() ) if ( m_workerRW && m_workerRW.data()->worker() )
m_workerRW.data()->worker().data()->enqueue( lc ); m_workerRW.data()->worker().data()->enqueue( lc );
} }
@@ -158,7 +158,7 @@ Database::enqueue( const QSharedPointer<DatabaseCommand>& lc )
happyWorker = workerThread.data()->worker(); happyWorker = workerThread.data()->worker();
} }
// qDebug() << "Enqueueing command to thread:" << happyThread << busyThreads << lc->commandname(); // tDebug( LOGVERBOSE ) << "Enqueueing command to thread:" << happyThread << busyThreads << lc->commandname();
Q_ASSERT( happyWorker ); Q_ASSERT( happyWorker );
happyWorker.data()->enqueue( lc ); happyWorker.data()->enqueue( lc );
} }
@@ -173,7 +173,7 @@ Database::impl()
QThread* thread = QThread::currentThread(); QThread* thread = QThread::currentThread();
if ( !m_implHash.contains( thread ) ) if ( !m_implHash.contains( thread ) )
{ {
tDebug() << Q_FUNC_INFO << "Creating database impl for thread" << QThread::currentThread(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Creating database impl for thread" << QThread::currentThread();
DatabaseImpl* impl = m_impl->clone(); DatabaseImpl* impl = m_impl->clone();
m_implHash.insert( thread, impl ); m_implHash.insert( thread, impl );
} }

View File

@@ -50,7 +50,7 @@ Connection::Connection( Servent* parent )
, m_tx_bytes_last( 0 ) , m_tx_bytes_last( 0 )
{ {
moveToThread( m_servent->thread() ); moveToThread( m_servent->thread() );
qDebug() << "CTOR Connection (super)" << thread(); tDebug( LOGVERBOSE ) << "CTOR Connection (super)" << thread();
connect( &m_msgprocessor_out, SIGNAL( ready( msg_ptr ) ), connect( &m_msgprocessor_out, SIGNAL( ready( msg_ptr ) ),
SLOT( sendMsg_now( msg_ptr ) ), Qt::QueuedConnection ); SLOT( sendMsg_now( msg_ptr ) ), Qt::QueuedConnection );
@@ -65,10 +65,9 @@ Connection::Connection( Servent* parent )
Connection::~Connection() Connection::~Connection()
{ {
tDebug() << "DTOR connection (super)" << id() << thread() << m_sock.isNull(); tDebug( LOGVERBOSE ) << "DTOR connection (super)" << id() << thread() << m_sock.isNull();
if ( !m_sock.isNull() ) if ( !m_sock.isNull() )
{ {
// qDebug() << "deleteLatering sock" << m_sock;
m_sock->deleteLater(); m_sock->deleteLater();
} }
@@ -86,7 +85,7 @@ Connection::handleIncomingQueueEmpty()
if ( !m_sock.isNull() && m_sock->bytesAvailable() == 0 && m_peer_disconnected ) if ( !m_sock.isNull() && m_sock->bytesAvailable() == 0 && m_peer_disconnected )
{ {
qDebug() << "No more data to read, peer disconnected. shutting down connection." tDebug( LOGVERBOSE ) << "No more data to read, peer disconnected. shutting down connection."
<< "bytesavail" << m_sock->bytesAvailable() << "bytesavail" << m_sock->bytesAvailable()
<< "bytesrx" << m_rx_bytes; << "bytesrx" << m_rx_bytes;
shutdown(); shutdown();
@@ -117,7 +116,7 @@ Connection::setFirstMessage( msg_ptr m )
void void
Connection::shutdown( bool waitUntilSentAll ) Connection::shutdown( bool waitUntilSentAll )
{ {
qDebug() << Q_FUNC_INFO << waitUntilSentAll << id(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << waitUntilSentAll << id();
if ( m_do_shutdown ) if ( m_do_shutdown )
{ {
//qDebug() << id() << " already shutting down"; //qDebug() << id() << " already shutting down";
@@ -132,7 +131,7 @@ Connection::shutdown( bool waitUntilSentAll )
} }
else else
{ {
qDebug() << "Shutting down after transfer complete " << id() tDebug( LOGVERBOSE ) << "Shutting down after transfer complete " << id()
<< "Actual/Desired" << m_tx_bytes << m_tx_bytes_requested; << "Actual/Desired" << m_tx_bytes << m_tx_bytes_requested;
bytesWritten( 0 ); // trigger shutdown if we've already sent everything bytesWritten( 0 ); // trigger shutdown if we've already sent everything
@@ -145,7 +144,7 @@ Connection::shutdown( bool waitUntilSentAll )
void void
Connection::actualShutdown() Connection::actualShutdown()
{ {
qDebug() << Q_FUNC_INFO << m_actually_shutting_down << id(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << m_actually_shutting_down << id();
if ( m_actually_shutting_down ) if ( m_actually_shutting_down )
{ {
return; return;
@@ -165,7 +164,7 @@ Connection::actualShutdown()
void void
Connection::markAsFailed() Connection::markAsFailed()
{ {
qDebug() << "Connection" << id() << "FAILED ***************" << thread(); tDebug( LOGVERBOSE ) << "Connection" << id() << "FAILED ***************" << thread();
emit failed(); emit failed();
shutdown(); shutdown();
} }
@@ -194,7 +193,7 @@ Connection::checkACL()
{ {
if ( !property( "nodeid" ).isValid() ) if ( !property( "nodeid" ).isValid() )
{ {
tLog() << Q_FUNC_INFO << "Not checking ACL, nodeid is empty"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Not checking ACL, nodeid is empty";
QTimer::singleShot( 0, this, SLOT( doSetup() ) ); QTimer::singleShot( 0, this, SLOT( doSetup() ) );
return; return;
} }
@@ -219,7 +218,7 @@ Connection::checkACLResult( const QString &nodeid, const QString &username, ACLR
QString bareName = name().contains( '/' ) ? name().left( name().indexOf( "/" ) ) : name(); QString bareName = name().contains( '/' ) ? name().left( name().indexOf( "/" ) ) : name();
if ( nodeid != property( "nodeid" ).toString() || username != bareName ) if ( nodeid != property( "nodeid" ).toString() || username != bareName )
{ {
tLog() << Q_FUNC_INFO << "nodeid not ours, or username not our barename"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "nodeid not ours, or username not our barename";
return; return;
} }
@@ -241,7 +240,7 @@ Connection::authCheckTimeout()
if ( m_ready ) if ( m_ready )
return; return;
qDebug() << "Closing connection, not authed in time."; tDebug( LOGVERBOSE ) << "Closing connection, not authed in time.";
shutdown(); shutdown();
} }
@@ -249,7 +248,7 @@ Connection::authCheckTimeout()
void void
Connection::doSetup() Connection::doSetup()
{ {
qDebug() << Q_FUNC_INFO << thread(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << thread();
/* /*
New connections can be created from other thread contexts, such as New connections can be created from other thread contexts, such as
when AudioEngine calls getIODevice.. - we need to ensure that connections when AudioEngine calls getIODevice.. - we need to ensure that connections
@@ -260,7 +259,6 @@ Connection::doSetup()
if ( QThread::currentThread() != m_servent->thread() ) if ( QThread::currentThread() != m_servent->thread() )
{ {
// Connections should always be in the same thread as the servent. // Connections should always be in the same thread as the servent.
qDebug() << "Fixing thead affinity...";
moveToThread( m_servent->thread() ); moveToThread( m_servent->thread() );
} }
@@ -308,7 +306,7 @@ Connection::doSetup()
void void
Connection::socketDisconnected() Connection::socketDisconnected()
{ {
tDebug() << "SOCKET DISCONNECTED" << this->name() << id() tDebug( LOGVERBOSE ) << "SOCKET DISCONNECTED" << this->name() << id()
<< "shutdown will happen after incoming queue empties." << "shutdown will happen after incoming queue empties."
<< "bytesavail:" << m_sock->bytesAvailable() << "bytesavail:" << m_sock->bytesAvailable()
<< "bytesRecvd" << bytesReceived(); << "bytesRecvd" << bytesReceived();
@@ -327,7 +325,7 @@ Connection::socketDisconnected()
void void
Connection::socketDisconnectedError( QAbstractSocket::SocketError e ) Connection::socketDisconnectedError( QAbstractSocket::SocketError e )
{ {
qDebug() << "SOCKET ERROR CODE" << e << this->name() << "CALLING Connection::shutdown(false)"; tDebug() << "SOCKET ERROR CODE" << e << this->name() << "CALLING Connection::shutdown(false)";
if ( e == QAbstractSocket::RemoteHostClosedError ) if ( e == QAbstractSocket::RemoteHostClosedError )
return; return;
@@ -368,7 +366,7 @@ Connection::readyRead()
char msgheader[ Msg::headerSize() ]; char msgheader[ Msg::headerSize() ];
if ( m_sock->read( (char*) &msgheader, Msg::headerSize() ) != Msg::headerSize() ) if ( m_sock->read( (char*) &msgheader, Msg::headerSize() ) != Msg::headerSize() )
{ {
qDebug() << "Failed reading msg header"; tDebug() << "Failed reading msg header";
this->markAsFailed(); this->markAsFailed();
return; return;
} }
@@ -383,7 +381,7 @@ Connection::readyRead()
QByteArray ba = m_sock->read( m_msg->length() ); QByteArray ba = m_sock->read( m_msg->length() );
if ( ba.length() != (qint32)m_msg->length() ) if ( ba.length() != (qint32)m_msg->length() )
{ {
qDebug() << "Failed to read full msg payload"; tDebug() << "Failed to read full msg payload";
this->markAsFailed(); this->markAsFailed();
return; return;
} }
@@ -408,7 +406,7 @@ Connection::handleReadMsg()
m_msg->payload() == "ok" ) m_msg->payload() == "ok" )
{ {
m_ready = true; m_ready = true;
qDebug() << "Connection" << id() << "READY"; tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
setup(); setup();
emit ready(); emit ready();
} }
@@ -420,7 +418,7 @@ Connection::handleReadMsg()
{ {
sendMsg( Msg::factory( "ok", Msg::SETUP ) ); sendMsg( Msg::factory( "ok", Msg::SETUP ) );
m_ready = true; m_ready = true;
qDebug() << "Connection" << id() << "READY"; tDebug( LOGVERBOSE ) << "Connection" << id() << "READY";
setup(); setup();
emit ready(); emit ready();
} }
@@ -457,7 +455,7 @@ Connection::sendMsg( msg_ptr msg )
{ {
if ( m_do_shutdown ) if ( m_do_shutdown )
{ {
qDebug() << Q_FUNC_INFO << "SHUTTING DOWN, NOT SENDING msg flags:" tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "SHUTTING DOWN, NOT SENDING msg flags:"
<< (int)msg->flags() << "length:" << msg->length() << id(); << (int)msg->flags() << "length:" << msg->length() << id();
return; return;
} }
@@ -475,7 +473,7 @@ Connection::sendMsg_now( msg_ptr msg )
if ( m_sock.isNull() || !m_sock->isOpen() || !m_sock->isWritable() ) if ( m_sock.isNull() || !m_sock->isOpen() || !m_sock->isWritable() )
{ {
qDebug() << "***** Socket problem, whilst in sendMsg(). Cleaning up. *****"; tDebug() << "***** Socket problem, whilst in sendMsg(). Cleaning up. *****";
shutdown( false ); shutdown( false );
return; return;
} }

View File

@@ -124,7 +124,7 @@ DBSyncConnection::check()
if ( m_source->lastCmdGuid().isEmpty() ) if ( m_source->lastCmdGuid().isEmpty() )
{ {
tDebug() << "Fetching lastCmdGuid from database!"; tDebug( LOGVERBOSE ) << "Fetching lastCmdGuid from database!";
DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source ); DatabaseCommand_CollectionStats* cmd_them = new DatabaseCommand_CollectionStats( m_source );
connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) ); connect( cmd_them, SIGNAL( done( QVariantMap ) ), SLOT( gotThem( QVariantMap ) ) );
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) ); Database::instance()->enqueue( QSharedPointer<DatabaseCommand>(cmd_them) );

View File

@@ -115,7 +115,7 @@ appConfigDir()
} }
else else
{ {
qDebug() << "Error, $HOME not set."; tDebug() << "Error, $HOME not set.";
throw "$HOME not set"; throw "$HOME not set";
return QDir( "/tmp" ); return QDir( "/tmp" );
} }
@@ -135,7 +135,7 @@ appConfigDir()
} }
else else
{ {
qDebug() << "Error, $HOME or $XDG_CONFIG_HOME not set."; tDebug() << "Error, $HOME or $XDG_CONFIG_HOME not set.";
throw "Error, $HOME or $XDG_CONFIG_HOME not set."; throw "Error, $HOME or $XDG_CONFIG_HOME not set.";
ret = QDir( "/tmp" ); ret = QDir( "/tmp" );
} }
@@ -449,7 +449,7 @@ void
NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts ) NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts )
{ {
QStringList newList; QStringList newList;
tDebug() << Q_FUNC_INFO << "No-proxy hosts:" << hosts; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "No-proxy hosts:" << hosts;
foreach ( const QString& host, hosts ) foreach ( const QString& host, hosts )
{ {
QString munge = host.simplified(); QString munge = host.simplified();
@@ -457,7 +457,7 @@ NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts )
//TODO: wildcard support //TODO: wildcard support
} }
tDebug() << Q_FUNC_INFO << "New no-proxy hosts:" << newList; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "New no-proxy hosts:" << newList;
s_noProxyHostsMutex.lock(); s_noProxyHostsMutex.lock();
s_noProxyHosts = newList; s_noProxyHosts = newList;
@@ -468,7 +468,6 @@ NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts )
void void
NetworkProxyFactory::setProxy( const QNetworkProxy& proxy ) NetworkProxyFactory::setProxy( const QNetworkProxy& proxy )
{ {
m_proxyChanged = false; m_proxyChanged = false;
if ( m_proxy != proxy ) if ( m_proxy != proxy )
m_proxyChanged = true; m_proxyChanged = true;
@@ -479,16 +478,17 @@ NetworkProxyFactory::setProxy( const QNetworkProxy& proxy )
proxyCaps |= QNetworkProxy::ListeningCapability; proxyCaps |= QNetworkProxy::ListeningCapability;
if ( TomahawkSettings::instance()->proxyDns() ) if ( TomahawkSettings::instance()->proxyDns() )
proxyCaps |= QNetworkProxy::HostNameLookupCapability; proxyCaps |= QNetworkProxy::HostNameLookupCapability;
m_proxy.setCapabilities( proxyCaps ); m_proxy.setCapabilities( proxyCaps );
tDebug() << Q_FUNC_INFO << "Proxy using host" << proxy.hostName() << "and port" << proxy.port(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Proxy using host" << proxy.hostName() << "and port" << proxy.port();
tDebug() << Q_FUNC_INFO << "setting proxy to use proxy DNS?" << (TomahawkSettings::instance()->proxyDns() ? "true" : "false"); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "setting proxy to use proxy DNS?" << (TomahawkSettings::instance()->proxyDns() ? "true" : "false");
} }
NetworkProxyFactory& NetworkProxyFactory&
NetworkProxyFactory::operator=( const NetworkProxyFactory& rhs ) NetworkProxyFactory::operator=( const NetworkProxyFactory& rhs )
{ {
tDebug() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
if ( this != &rhs ) if ( this != &rhs )
{ {
m_proxy = QNetworkProxy( rhs.m_proxy ); m_proxy = QNetworkProxy( rhs.m_proxy );
@@ -500,7 +500,7 @@ NetworkProxyFactory::operator=( const NetworkProxyFactory& rhs )
bool NetworkProxyFactory::operator==( const NetworkProxyFactory& other ) const bool NetworkProxyFactory::operator==( const NetworkProxyFactory& other ) const
{ {
tDebug() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
if ( m_proxy != other.m_proxy ) if ( m_proxy != other.m_proxy )
return false; return false;
@@ -515,7 +515,7 @@ NetworkProxyFactory*
proxyFactory( bool makeClone, bool noMutexLocker ) proxyFactory( bool makeClone, bool noMutexLocker )
{ {
// Don't lock if being called from nam() // Don't lock if being called from nam()
tDebug() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
QMutex otherMutex; QMutex otherMutex;
QMutexLocker locker( noMutexLocker ? &otherMutex : &s_namAccessMutex ); QMutexLocker locker( noMutexLocker ? &otherMutex : &s_namAccessMutex );
@@ -543,7 +543,7 @@ proxyFactory( bool makeClone, bool noMutexLocker )
void void
setProxyFactory( NetworkProxyFactory* factory, bool noMutexLocker ) setProxyFactory( NetworkProxyFactory* factory, bool noMutexLocker )
{ {
tDebug() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
Q_ASSERT( factory ); Q_ASSERT( factory );
// Don't lock if being called from setNam() // Don't lock if being called from setNam()
QMutex otherMutex; QMutex otherMutex;
@@ -589,7 +589,7 @@ nam()
else else
return 0; return 0;
} }
tDebug() << Q_FUNC_INFO << "Found gui thread in nam hash"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Found gui thread in nam hash";
// Create a nam for this thread based on the main thread's settings but with its own proxyfactory // Create a nam for this thread based on the main thread's settings but with its own proxyfactory
QNetworkAccessManager *mainNam = s_threadNamHash[ TOMAHAWK_APPLICATION::instance()->thread() ]; QNetworkAccessManager *mainNam = s_threadNamHash[ TOMAHAWK_APPLICATION::instance()->thread() ];
@@ -601,7 +601,7 @@ nam()
s_threadNamHash[ QThread::currentThread() ] = newNam; s_threadNamHash[ QThread::currentThread() ] = newNam;
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "created new nam for thread" << QThread::currentThread(); tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "created new nam for thread" << QThread::currentThread();
//QNetworkProxy proxy = dynamic_cast< TomahawkUtils::NetworkProxyFactory* >( newNam->proxyFactory() )->proxy(); //QNetworkProxy proxy = dynamic_cast< TomahawkUtils::NetworkProxyFactory* >( newNam->proxyFactory() )->proxy();
//tDebug() << Q_FUNC_INFO << "reply proxy properties:" << proxy.type() << proxy.hostName() << proxy.port(); //tDebug() << Q_FUNC_INFO << "reply proxy properties:" << proxy.type() << proxy.hostName() << proxy.port();
@@ -619,13 +619,13 @@ setNam( QNetworkAccessManager* nam, bool noMutexLocker )
if ( !s_threadNamHash.contains( TOMAHAWK_APPLICATION::instance()->thread() ) && if ( !s_threadNamHash.contains( TOMAHAWK_APPLICATION::instance()->thread() ) &&
QThread::currentThread() == TOMAHAWK_APPLICATION::instance()->thread() ) QThread::currentThread() == TOMAHAWK_APPLICATION::instance()->thread() )
{ {
tDebug( LOGEXTRA ) << "creating initial gui thread (" << TOMAHAWK_APPLICATION::instance()->thread() << ") nam"; tDebug( LOGVERBOSE ) << "creating initial gui thread (" << TOMAHAWK_APPLICATION::instance()->thread() << ") nam";
// Should only get here on first initialization of the nam // Should only get here on first initialization of the nam
TomahawkSettings *s = TomahawkSettings::instance(); TomahawkSettings *s = TomahawkSettings::instance();
TomahawkUtils::NetworkProxyFactory* proxyFactory = new TomahawkUtils::NetworkProxyFactory(); TomahawkUtils::NetworkProxyFactory* proxyFactory = new TomahawkUtils::NetworkProxyFactory();
if ( s->proxyType() != QNetworkProxy::NoProxy && !s->proxyHost().isEmpty() ) if ( s->proxyType() != QNetworkProxy::NoProxy && !s->proxyHost().isEmpty() )
{ {
tDebug( LOGEXTRA ) << "Setting proxy to saved values"; tDebug( LOGVERBOSE ) << "Setting proxy to saved values";
QNetworkProxy proxy( s->proxyType(), s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() ); QNetworkProxy proxy( s->proxyType(), s->proxyHost(), s->proxyPort(), s->proxyUsername(), s->proxyPassword() );
proxyFactory->setProxy( proxy ); proxyFactory->setProxy( proxy );
//FIXME: Jreen is broke without this //FIXME: Jreen is broke without this
@@ -843,7 +843,7 @@ verifyFile( const QString& filePath, const QString& signature )
return false; return false;
} }
qDebug() << "Successfully verified signature of downloaded file:" << filePath; tDebug( LOGVERBOSE ) << "Successfully verified signature of downloaded file:" << filePath;
return true; return true;
} }
@@ -890,7 +890,7 @@ unzipFileInFolder( const QString& zipFileName, const QDir& folder )
return false; return false;
} }
tDebug() << "Unzipping files to:" << folder.absolutePath(); tDebug( LOGVERBOSE ) << "Unzipping files to:" << folder.absolutePath();
QuaZipFile fileInZip( &zipFile ); QuaZipFile fileInZip( &zipFile );
do do
@@ -915,7 +915,7 @@ unzipFileInFolder( const QString& zipFileName, const QDir& folder )
folder.mkpath( dirPath ); folder.mkpath( dirPath );
} }
tDebug() << "Writing to output file..." << out.fileName(); tDebug( LOGVERBOSE ) << "Writing to output file..." << out.fileName();
if ( !out.open( QIODevice::WriteOnly ) ) if ( !out.open( QIODevice::WriteOnly ) )
{ {
tLog() << "Failed to open zip extract file:" << out.errorString() << info.name; tLog() << "Failed to open zip extract file:" << out.errorString() << info.name;

View File

@@ -72,7 +72,7 @@ FadingPixmap::onAnimationStep( int frame )
void void
FadingPixmap::onAnimationFinished() FadingPixmap::onAnimationFinished()
{ {
tDebug() << Q_FUNC_INFO; tDebug( LOGVERBOSE ) << Q_FUNC_INFO;
m_oldPixmap = QPixmap(); m_oldPixmap = QPixmap();
repaint(); repaint();

View File

@@ -130,7 +130,7 @@ NewReleasesWidget::fetchData()
requestData.allSources = true; requestData.allSources = true;
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData ); Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
tDebug( LOGVERBOSE ) << "NewReleases: requested InfoNewReleaseCapabilities"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Requested InfoNewReleaseCapabilities";
} }
@@ -142,7 +142,7 @@ NewReleasesWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData request
if ( !output.canConvert< QVariantMap >() ) if ( !output.canConvert< QVariantMap >() )
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "NewReleases: Could not parse output"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Could not parse output";
return; return;
} }
@@ -151,14 +151,14 @@ NewReleasesWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData request
{ {
case InfoSystem::InfoNewReleaseCapabilities: case InfoSystem::InfoNewReleaseCapabilities:
{ {
tLog() << "NewReleases: got InfoNewReleaseCapabilities"; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got InfoNewReleaseCapabilities";
QStandardItem *rootItem= m_crumbModelLeft->invisibleRootItem(); QStandardItem *rootItem= m_crumbModelLeft->invisibleRootItem();
foreach ( const QString label, returnedData.keys() ) foreach ( const QString label, returnedData.keys() )
{ {
QStandardItem *childItem = parseNode( rootItem, label, returnedData[label] ); QStandardItem *childItem = parseNode( rootItem, label, returnedData[label] );
rootItem->appendRow(childItem); rootItem->appendRow(childItem);
tLog() << "NewReleases: " << label; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "NewReleases:" << label;
} }
m_sortedProxy->setSourceModel( m_crumbModelLeft ); m_sortedProxy->setSourceModel( m_crumbModelLeft );
@@ -267,7 +267,7 @@ NewReleasesWidget::leftCrumbIndexChanged( QModelIndex index )
requestData.timeoutMillis = 20000; requestData.timeoutMillis = 20000;
requestData.allSources = true; requestData.allSources = true;
qDebug() << "Making infosystem request for chart of type:" <<nrId; tDebug( LOGVERBOSE ) << "Making infosystem request for chart of type:" << nrId;
Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData ); Tomahawk::InfoSystem::InfoSystem::instance()->getInfo( requestData );
m_queuedFetches.insert( nrId ); m_queuedFetches.insert( nrId );