mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Style cleanup.
This commit is contained in:
@@ -108,7 +108,7 @@ appConfigDir()
|
|||||||
QDir ret;
|
QDir ret;
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
if( getenv( "HOME" ) )
|
if ( getenv( "HOME" ) )
|
||||||
{
|
{
|
||||||
return QDir( QString( "%1" ).arg( 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
|
return QDir( "c:\\" ); //TODO refer to Qt documentation to get code to do this
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if( getenv( "XDG_CONFIG_HOME" ) )
|
if ( getenv( "XDG_CONFIG_HOME" ) )
|
||||||
{
|
{
|
||||||
ret = QDir( QString( "%1/Tomahawk" ).arg( 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" ) ) );
|
ret = QDir( QString( "%1/.config/Tomahawk" ).arg( getenv( "HOME" ) ) );
|
||||||
}
|
}
|
||||||
@@ -139,7 +139,7 @@ appConfigDir()
|
|||||||
ret = QDir( "/tmp" );
|
ret = QDir( "/tmp" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !ret.exists() )
|
if ( !ret.exists() )
|
||||||
{
|
{
|
||||||
ret.mkpath( ret.canonicalPath() );
|
ret.mkpath( ret.canonicalPath() );
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ NetworkProxyFactory::NetworkProxyFactory( const NetworkProxyFactory& other )
|
|||||||
QList< QNetworkProxy >
|
QList< QNetworkProxy >
|
||||||
NetworkProxyFactory::queryProxy( const QNetworkProxyQuery& query )
|
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;
|
QList< QNetworkProxy > proxies;
|
||||||
QString hostname = query.peerHostName();
|
QString hostname = query.peerHostName();
|
||||||
@@ -369,13 +369,15 @@ NetworkProxyFactory::setNoProxyHosts( const QStringList& hosts )
|
|||||||
{
|
{
|
||||||
QStringList newList;
|
QStringList newList;
|
||||||
tDebug() << Q_FUNC_INFO << "No-proxy hosts:" << hosts;
|
tDebug() << Q_FUNC_INFO << "No-proxy hosts:" << hosts;
|
||||||
foreach( QString host, hosts )
|
foreach ( const QString& host, hosts )
|
||||||
{
|
{
|
||||||
QString munge = host.simplified();
|
QString munge = host.simplified();
|
||||||
newList << munge;
|
newList << munge;
|
||||||
//TODO: wildcard support
|
//TODO: wildcard support
|
||||||
}
|
}
|
||||||
|
|
||||||
tDebug() << Q_FUNC_INFO << "New no-proxy hosts:" << newList;
|
tDebug() << Q_FUNC_INFO << "New no-proxy hosts:" << newList;
|
||||||
|
|
||||||
s_noProxyHostsMutex.lock();
|
s_noProxyHostsMutex.lock();
|
||||||
s_noProxyHosts = newList;
|
s_noProxyHosts = newList;
|
||||||
s_noProxyHostsMutex.unlock();
|
s_noProxyHostsMutex.unlock();
|
||||||
@@ -466,7 +468,7 @@ setProxyFactory( NetworkProxyFactory* factory, bool noMutexLocker )
|
|||||||
|
|
||||||
if ( QThread::currentThread() == TOMAHAWK_APPLICATION::instance()->thread() )
|
if ( QThread::currentThread() == TOMAHAWK_APPLICATION::instance()->thread() )
|
||||||
{
|
{
|
||||||
foreach( QThread* thread, s_threadProxyFactoryHash.keys() )
|
foreach ( QThread* thread, s_threadProxyFactoryHash.keys() )
|
||||||
{
|
{
|
||||||
if ( thread != QThread::currentThread() )
|
if ( thread != QThread::currentThread() )
|
||||||
{
|
{
|
||||||
@@ -513,9 +515,9 @@ nam()
|
|||||||
|
|
||||||
s_threadNamHash[ QThread::currentThread() ] = newNam;
|
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();
|
//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;
|
return newNam;
|
||||||
}
|
}
|
||||||
@@ -632,23 +634,30 @@ mergePlaylistChanges( const QList< Tomahawk::query_ptr >& orig, const QList< Tom
|
|||||||
bool
|
bool
|
||||||
removeDirectory( const QString& dir )
|
removeDirectory( const QString& dir )
|
||||||
{
|
{
|
||||||
const QDir aDir(dir);
|
const QDir aDir( dir );
|
||||||
|
|
||||||
tLog() << "Deleting DIR:" << dir;
|
tLog() << "Deleting DIR:" << dir;
|
||||||
bool has_err = false;
|
bool has_err = false;
|
||||||
if (aDir.exists()) {
|
if ( aDir.exists() )
|
||||||
foreach(const QFileInfo& entry, aDir.entryInfoList(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks)) {
|
{
|
||||||
|
foreach ( const QFileInfo& entry, aDir.entryInfoList( QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::NoSymLinks ) )
|
||||||
|
{
|
||||||
QString path = entry.absoluteFilePath();
|
QString path = entry.absoluteFilePath();
|
||||||
if (entry.isDir()) {
|
if ( entry.isDir() )
|
||||||
has_err = !removeDirectory(path) || has_err;
|
{
|
||||||
} else if (!QFile::remove(path)) {
|
has_err = !removeDirectory( path ) || has_err;
|
||||||
|
}
|
||||||
|
else if ( !QFile::remove( path ) )
|
||||||
|
{
|
||||||
has_err = true;
|
has_err = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!aDir.rmdir(aDir.absolutePath())) {
|
if ( !aDir.rmdir( aDir.absolutePath() ) )
|
||||||
|
{
|
||||||
has_err = true;
|
has_err = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return !has_err;
|
return !has_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -680,11 +689,11 @@ crash()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
verifyFile( const QString &filePath, const QString &signature )
|
verifyFile( const QString& filePath, const QString& signature )
|
||||||
{
|
{
|
||||||
QCA::Initializer init;
|
QCA::Initializer init;
|
||||||
|
|
||||||
if( !QCA::isSupported( "sha1" ) )
|
if ( !QCA::isSupported( "sha1" ) )
|
||||||
{
|
{
|
||||||
qWarning() << "SHA1 not supported by QCA, aborting.";
|
qWarning() << "SHA1 not supported by QCA, aborting.";
|
||||||
return false;
|
return false;
|
||||||
@@ -761,7 +770,7 @@ extractScriptPayload( const QString& filename, const QString& resolverId )
|
|||||||
QDir resolverDir = appDataDir();
|
QDir resolverDir = appDataDir();
|
||||||
if ( !resolverDir.mkpath( QString( "atticaresolvers/%1" ).arg( resolverId ) ) )
|
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();
|
return QString();
|
||||||
}
|
}
|
||||||
resolverDir.cd( QString( "atticaresolvers/%1" ).arg( resolverId ) );
|
resolverDir.cd( QString( "atticaresolvers/%1" ).arg( resolverId ) );
|
||||||
@@ -777,7 +786,7 @@ extractScriptPayload( const QString& filename, const QString& resolverId )
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
unzipFileInFolder( const QString &zipFileName, const QDir &folder )
|
unzipFileInFolder( const QString& zipFileName, const QDir& folder )
|
||||||
{
|
{
|
||||||
Q_ASSERT( !zipFileName.isEmpty() );
|
Q_ASSERT( !zipFileName.isEmpty() );
|
||||||
Q_ASSERT( folder.exists() );
|
Q_ASSERT( folder.exists() );
|
||||||
@@ -791,7 +800,7 @@ unzipFileInFolder( const QString &zipFileName, const QDir &folder )
|
|||||||
|
|
||||||
if ( !zipFile.goToFirstFile() )
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -67,7 +67,7 @@ namespace TomahawkUtils
|
|||||||
public:
|
public:
|
||||||
NetworkProxyFactory()
|
NetworkProxyFactory()
|
||||||
: m_proxy( QNetworkProxy::NoProxy )
|
: m_proxy( QNetworkProxy::NoProxy )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
NetworkProxyFactory( const NetworkProxyFactory &other );
|
NetworkProxyFactory( const NetworkProxyFactory &other );
|
||||||
virtual ~NetworkProxyFactory() {}
|
virtual ~NetworkProxyFactory() {}
|
||||||
|
Reference in New Issue
Block a user