mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-07 14:46:33 +02:00
Revert "Go back to previous setNam, but functionality should really be identical."
Also remove some debug
This reverts commit e0177ed895
.
Conflicts:
src/libtomahawk/utils/tomahawkutils.cpp
This commit is contained in:
@@ -481,7 +481,6 @@ NetworkProxyFactory::NetworkProxyFactory( const NetworkProxyFactory& other )
|
|||||||
QList< QNetworkProxy >
|
QList< QNetworkProxy >
|
||||||
NetworkProxyFactory::proxyForQuery( const QNetworkProxyQuery& query )
|
NetworkProxyFactory::proxyForQuery( const QNetworkProxyQuery& query )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << " in thread " << QThread::currentThread() << " for query " << query.url();
|
|
||||||
TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory();
|
TomahawkUtils::NetworkProxyFactory* proxyFactory = TomahawkUtils::proxyFactory();
|
||||||
QList< QNetworkProxy > proxies = proxyFactory->queryProxy( query );
|
QList< QNetworkProxy > proxies = proxyFactory->queryProxy( query );
|
||||||
return proxies;
|
return proxies;
|
||||||
@@ -491,7 +490,6 @@ NetworkProxyFactory::proxyForQuery( const QNetworkProxyQuery& query )
|
|||||||
QList< QNetworkProxy >
|
QList< QNetworkProxy >
|
||||||
NetworkProxyFactory::queryProxy( const QNetworkProxyQuery& query )
|
NetworkProxyFactory::queryProxy( const QNetworkProxyQuery& query )
|
||||||
{
|
{
|
||||||
tDebug() << Q_FUNC_INFO << " in thread " << QThread::currentThread() << " for query " << query.url();
|
|
||||||
QList< QNetworkProxy > proxies;
|
QList< QNetworkProxy > proxies;
|
||||||
QString hostname = query.peerHostName();
|
QString hostname = query.peerHostName();
|
||||||
if ( hostname.isEmpty() || m_noProxyHosts.contains( hostname ) )
|
if ( hostname.isEmpty() || m_noProxyHosts.contains( hostname ) )
|
||||||
@@ -615,14 +613,16 @@ nam()
|
|||||||
{
|
{
|
||||||
QMutexLocker locker( &s_namAccessMutex );
|
QMutexLocker locker( &s_namAccessMutex );
|
||||||
if ( s_threadNamHash.contains( QThread::currentThread() ) )
|
if ( s_threadNamHash.contains( QThread::currentThread() ) )
|
||||||
{
|
|
||||||
tDebug( LOGEXTRA ) << "returning existing nam for thread " << QThread::currentThread();
|
|
||||||
return s_threadNamHash[ QThread::currentThread() ];
|
return s_threadNamHash[ QThread::currentThread() ];
|
||||||
}
|
|
||||||
|
|
||||||
if ( !s_threadNamHash.contains( TOMAHAWK_APPLICATION::instance()->thread() ) )
|
if ( !s_threadNamHash.contains( TOMAHAWK_APPLICATION::instance()->thread() ) )
|
||||||
{
|
{
|
||||||
tDebug( LOGEXTRA ) << "no gui thread (" << TOMAHAWK_APPLICATION::instance()->thread() << ") nam available to copy, returning 0";
|
if ( QThread::currentThread() == TOMAHAWK_APPLICATION::instance()->thread() )
|
||||||
|
{
|
||||||
|
setNam( new QNetworkAccessManager(), true );
|
||||||
|
return s_threadNamHash[ QThread::currentThread() ];
|
||||||
|
}
|
||||||
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,12 +643,12 @@ nam()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setNam( QNetworkAccessManager* nam )
|
setNam( QNetworkAccessManager* nam, bool noMutexLocker )
|
||||||
{
|
{
|
||||||
Q_ASSERT( nam );
|
Q_ASSERT( nam );
|
||||||
// Don't lock if being called from nam()()
|
// Don't lock if being called from nam()()
|
||||||
tDebug( LOGEXTRA ) << "setting nam for thread " << QThread::currentThread();
|
QMutex otherMutex;
|
||||||
QMutexLocker locker( &s_namAccessMutex );
|
QMutexLocker locker( noMutexLocker ? &otherMutex : &s_namAccessMutex );
|
||||||
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() )
|
||||||
{
|
{
|
||||||
|
@@ -98,7 +98,7 @@ namespace TomahawkUtils
|
|||||||
DLLEXPORT QNetworkAccessManager* nam();
|
DLLEXPORT QNetworkAccessManager* nam();
|
||||||
|
|
||||||
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory, bool noMutexLocker = false );
|
DLLEXPORT void setProxyFactory( TomahawkUtils::NetworkProxyFactory* factory, bool noMutexLocker = false );
|
||||||
DLLEXPORT void setNam( QNetworkAccessManager* nam );
|
DLLEXPORT void setNam( QNetworkAccessManager* nam, bool noMutexLocker = false );
|
||||||
|
|
||||||
DLLEXPORT QWidget* tomahawkWindow();
|
DLLEXPORT QWidget* tomahawkWindow();
|
||||||
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
/// Platform-specific bringing tomahawk mainwindow to front, b/c qt's activate() and such don't seem to work well enough for us
|
||||||
|
@@ -161,7 +161,7 @@ TomahawkApp::init()
|
|||||||
|
|
||||||
tDebug( LOGINFO ) << "Setting NAM.";
|
tDebug( LOGINFO ) << "Setting NAM.";
|
||||||
// Cause the creation of the nam, but don't need to address it directly, so prevent warning
|
// Cause the creation of the nam, but don't need to address it directly, so prevent warning
|
||||||
TomahawkUtils::setNam( new QNetworkAccessManager() );
|
Q_UNUSED( TomahawkUtils::nam() );
|
||||||
|
|
||||||
m_audioEngine = QWeakPointer<AudioEngine>( new AudioEngine );
|
m_audioEngine = QWeakPointer<AudioEngine>( new AudioEngine );
|
||||||
m_scanManager = QWeakPointer<ScanManager>( new ScanManager( this ) );
|
m_scanManager = QWeakPointer<ScanManager>( new ScanManager( this ) );
|
||||||
|
Reference in New Issue
Block a user