diff --git a/src/libtomahawk/utils/tomahawkutils.cpp b/src/libtomahawk/utils/tomahawkutils.cpp index 1b5db86fe..03b7e9161 100644 --- a/src/libtomahawk/utils/tomahawkutils.cpp +++ b/src/libtomahawk/utils/tomahawkutils.cpp @@ -116,6 +116,17 @@ appDataDir() } +QDir +appLogDir() +{ +#ifndef Q_WS_MAC + return appDataDir(); +#else + return QDir( QDir::homePath() + "/Library/Logs" ); +#endif +} + + QString timeToString( int seconds ) { diff --git a/src/libtomahawk/utils/tomahawkutils.h b/src/libtomahawk/utils/tomahawkutils.h index 1696dbd00..4161a8cde 100644 --- a/src/libtomahawk/utils/tomahawkutils.h +++ b/src/libtomahawk/utils/tomahawkutils.h @@ -26,15 +26,16 @@ namespace TomahawkUtils //a non-static non-singleton normal utility class then. class DLLEXPORT DNSResolver : public QObject { - Q_OBJECT + Q_OBJECT + public: explicit DNSResolver(); ~DNSResolver() {} - void resolve( QString &host, QString type ); + void resolve( QString& host, QString type ); signals: - void result( QString &result ); + void result( QString& result ); public slots: void resultsReady(); @@ -47,23 +48,24 @@ namespace TomahawkUtils class DLLEXPORT Sleep : public QThread { public: - static void sleep(unsigned long secs) + static void sleep( unsigned long secs ) { - QThread::sleep(secs); + QThread::sleep( secs ); } - static void msleep(unsigned long msecs) + static void msleep( unsigned long msecs ) { - QThread::msleep(msecs); + QThread::msleep( msecs ); } - static void usleep(unsigned long usecs) + static void usleep( unsigned long usecs ) { - QThread::usleep(usecs); + QThread::usleep( usecs ); } }; DLLEXPORT QDir appConfigDir(); DLLEXPORT QDir appDataDir(); - + DLLEXPORT QDir appLogDir(); + DLLEXPORT QString timeToString( int seconds ); DLLEXPORT QString ageToString( const QDateTime& time ); DLLEXPORT QString filesizeToString( unsigned int size ); diff --git a/src/main.cpp b/src/main.cpp index d755703d2..137172c69 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,13 +1,14 @@ #include "tomahawk/tomahawkapp.h" #ifdef Q_WS_MAC -#include "tomahawkapp_mac.h" -#include -static pascal OSErr appleEventHandler( const AppleEvent*, AppleEvent*, long ); + #include "tomahawkapp_mac.h" + #include + static pascal OSErr appleEventHandler( const AppleEvent*, AppleEvent*, long ); #endif #include -int main( int argc, char *argv[] ) +int +main( int argc, char *argv[] ) { #ifdef Q_WS_MAC // Do Mac specific startup to get media keys working. @@ -19,21 +20,25 @@ int main( int argc, char *argv[] ) AEInstallEventHandler( 'GURL', 'GURL', h, 0, false ); #endif - try { + try + { TomahawkApp a( argc, argv ); return a.exec(); - } catch( const std::runtime_error& e ) { + } + catch( const std::runtime_error& e ) + { return 0; } } #ifdef Q_WS_MAC -static pascal OSErr appleEventHandler( const AppleEvent* e, AppleEvent*, long ) +static pascal OSErr +appleEventHandler( const AppleEvent* e, AppleEvent*, long ) { OSType id = typeWildCard; - AEGetAttributePtr( e, keyEventIDAttr, typeType, 0, &id, sizeof(id), 0 ); + AEGetAttributePtr( e, keyEventIDAttr, typeType, 0, &id, sizeof( id ), 0 ); - switch (id) + switch ( id ) { case 'GURL': { diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index 62fb28086..860b2aed7 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -51,7 +51,7 @@ #include #include -#define LOGFILE TomahawkUtils::appDataDir().filePath( "tomahawk.log" ).toLocal8Bit() +#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit() #define LOGFILE_SIZE 1024 * 512 using namespace std;