1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-28 03:32:27 +01:00

* Style cleanup.

This commit is contained in:
Christian Muehlhaeuser 2012-06-24 23:55:00 +02:00
parent 746914844e
commit f2101c2986
2 changed files with 31 additions and 22 deletions

View File

@ -108,7 +108,7 @@ appConfigDir()
QDir ret;
#ifdef Q_WS_MAC
if( getenv( "HOME" ) )
if ( getenv( "HOME" ) )
{
return QDir( QString( "%1" ).arg( getenv( "HOME" ) ) );
}
@ -124,11 +124,11 @@ appConfigDir()
return QDir( "c:\\" ); //TODO refer to Qt documentation to get code to do this
#else
if( getenv( "XDG_CONFIG_HOME" ) )
if ( getenv( "XDG_CONFIG_HOME" ) )
{
ret = QDir( QString( "%1/Tomahawk" ).arg( getenv( "XDG_CONFIG_HOME" ) ) );
}
else if( getenv( "HOME" ) )
else if ( getenv( "HOME" ) )
{
ret = QDir( QString( "%1/.config/Tomahawk" ).arg( getenv( "HOME" ) ) );
}
@ -139,7 +139,7 @@ appConfigDir()
ret = QDir( "/tmp" );
}
if( !ret.exists() )
if ( !ret.exists() )
{
ret.mkpath( ret.canonicalPath() );
}
@ -348,7 +348,7 @@ NetworkProxyFactory::NetworkProxyFactory( const NetworkProxyFactory& other )
QList< QNetworkProxy >
NetworkProxyFactory::queryProxy( const QNetworkProxyQuery& query )
{
//tDebug() << Q_FUNC_INFO << "query hostname is " << query.peerHostName() << ", proxy host is " << m_proxy.hostName();
//tDebug() << Q_FUNC_INFO << "query hostname is" << query.peerHostName() << ", proxy host is" << m_proxy.hostName();
QList< QNetworkProxy > proxies;
QString hostname = query.peerHostName();
@ -369,13 +369,15 @@ NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts )
{
QStringList newList;
tDebug() << Q_FUNC_INFO << "No-proxy hosts:" << hosts;
foreach( QString host, hosts )
foreach ( const QString& host, hosts )
{
QString munge = host.simplified();
newList << munge;
//TODO: wildcard support
}
tDebug() << Q_FUNC_INFO << "New no-proxy hosts:" << newList;
s_noProxyHostsMutex.lock();
s_noProxyHosts = newList;
s_noProxyHostsMutex.unlock();
@ -466,7 +468,7 @@ setProxyFactory( NetworkProxyFactory* factory, bool noMutexLocker )
if ( QThread::currentThread() == TOMAHAWK_APPLICATION::instance()->thread() )
{
foreach( QThread* thread, s_threadProxyFactoryHash.keys() )
foreach ( QThread* thread, s_threadProxyFactoryHash.keys() )
{
if ( thread != QThread::currentThread() )
{
@ -513,9 +515,9 @@ nam()
s_threadNamHash[ QThread::currentThread() ] = newNam;
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "created new nam for thread " << QThread::currentThread();
tDebug( LOGEXTRA ) << Q_FUNC_INFO << "created new nam for thread" << QThread::currentThread();
//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();
return newNam;
}
@ -632,23 +634,30 @@ mergePlaylistChanges( const QList< Tomahawk::query_ptr >& orig, const QList< Tom
bool
removeDirectory( const QString& dir )
{
const QDir aDir(dir);
const QDir aDir( dir );
tLog() << "Deleting DIR:" << dir;
bool has_err = false;
if (aDir.exists()) {
foreach(const QFileInfo& entry, aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks)) {
if ( aDir.exists() )
{
foreach ( const QFileInfo& entry, aDir.entryInfoList( QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks ) )
{
QString path = entry.absoluteFilePath();
if (entry.isDir()) {
has_err = !removeDirectory(path) || has_err;
} else if (!QFile::remove(path)) {
if ( entry.isDir() )
{
has_err = !removeDirectory( path ) || has_err;
}
else if ( !QFile::remove( path ) )
{
has_err = true;
}
}
if (!aDir.rmdir(aDir.absolutePath())) {
if ( !aDir.rmdir( aDir.absolutePath() ) )
{
has_err = true;
}
}
return !has_err;
}
@ -680,11 +689,11 @@ crash()
bool
verifyFile( const QString &filePath, const QString &signature )
verifyFile( const QString& filePath, const QString& signature )
{
QCA::Initializer init;
if( !QCA::isSupported( "sha1" ) )
if ( !QCA::isSupported( "sha1" ) )
{
qWarning() << "SHA1 not supported by QCA, aborting.";
return false;
@ -761,7 +770,7 @@ extractScriptPayload( const QString& filename, const QString& resolverId )
QDir resolverDir = appDataDir();
if ( !resolverDir.mkpath( QString( "atticaresolvers/%1" ).arg( resolverId ) ) )
{
tLog() << "Failed to mkdir resolver save dir: " << TomahawkUtils::appDataDir().absoluteFilePath( QString( "atticaresolvers/%1" ).arg( resolverId ) );
tLog() << "Failed to mkdir resolver save dir:" << TomahawkUtils::appDataDir().absoluteFilePath( QString( "atticaresolvers/%1" ).arg( resolverId ) );
return QString();
}
resolverDir.cd( QString( "atticaresolvers/%1" ).arg( resolverId ) );
@ -777,7 +786,7 @@ extractScriptPayload( const QString& filename, const QString& resolverId )
bool
unzipFileInFolder( const QString &zipFileName, const QDir &folder )
unzipFileInFolder( const QString& zipFileName, const QDir& folder )
{
Q_ASSERT( !zipFileName.isEmpty() );
Q_ASSERT( folder.exists() );
@ -791,7 +800,7 @@ unzipFileInFolder( const QString &zipFileName, const QDir &folder )
if ( !zipFile.goToFirstFile() )
{
tLog() << "Failed to go to first file in zip archive: " << zipFile.getZipError();
tLog() << "Failed to go to first file in zip archive:" << zipFile.getZipError();
return false;
}

View File

@ -67,7 +67,7 @@ namespace TomahawkUtils
public:
NetworkProxyFactory()
: m_proxy( QNetworkProxy::NoProxy )
{}
{}
NetworkProxyFactory( const NetworkProxyFactory &other );
virtual ~NetworkProxyFactory() {}