1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-01 03:40:16 +02:00

* Write Tomahawk.log (note capital T) to correct directory.

This commit is contained in:
Christian Muehlhaeuser
2011-02-28 18:03:36 +01:00
parent 3cc29db086
commit 2ff3421261
4 changed files with 38 additions and 20 deletions

View File

@@ -116,6 +116,17 @@ appDataDir()
} }
QDir
appLogDir()
{
#ifndef Q_WS_MAC
return appDataDir();
#else
return QDir( QDir::homePath() + "/Library/Logs" );
#endif
}
QString QString
timeToString( int seconds ) timeToString( int seconds )
{ {

View File

@@ -26,15 +26,16 @@ namespace TomahawkUtils
//a non-static non-singleton normal utility class then. //a non-static non-singleton normal utility class then.
class DLLEXPORT DNSResolver : public QObject class DLLEXPORT DNSResolver : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit DNSResolver(); explicit DNSResolver();
~DNSResolver() {} ~DNSResolver() {}
void resolve( QString &host, QString type ); void resolve( QString& host, QString type );
signals: signals:
void result( QString &result ); void result( QString& result );
public slots: public slots:
void resultsReady(); void resultsReady();
@@ -47,23 +48,24 @@ namespace TomahawkUtils
class DLLEXPORT Sleep : public QThread class DLLEXPORT Sleep : public QThread
{ {
public: 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 appConfigDir();
DLLEXPORT QDir appDataDir(); DLLEXPORT QDir appDataDir();
DLLEXPORT QDir appLogDir();
DLLEXPORT QString timeToString( int seconds ); DLLEXPORT QString timeToString( int seconds );
DLLEXPORT QString ageToString( const QDateTime& time ); DLLEXPORT QString ageToString( const QDateTime& time );
DLLEXPORT QString filesizeToString( unsigned int size ); DLLEXPORT QString filesizeToString( unsigned int size );

View File

@@ -1,13 +1,14 @@
#include "tomahawk/tomahawkapp.h" #include "tomahawk/tomahawkapp.h"
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
#include "tomahawkapp_mac.h" #include "tomahawkapp_mac.h"
#include </System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/Headers/AppleEvents.h> #include </System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/Headers/AppleEvents.h>
static pascal OSErr appleEventHandler( const AppleEvent*, AppleEvent*, long ); static pascal OSErr appleEventHandler( const AppleEvent*, AppleEvent*, long );
#endif #endif
#include <exception> #include <exception>
int main( int argc, char *argv[] ) int
main( int argc, char *argv[] )
{ {
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// Do Mac specific startup to get media keys working. // 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 ); AEInstallEventHandler( 'GURL', 'GURL', h, 0, false );
#endif #endif
try { try
{
TomahawkApp a( argc, argv ); TomahawkApp a( argc, argv );
return a.exec(); return a.exec();
} catch( const std::runtime_error& e ) { }
catch( const std::runtime_error& e )
{
return 0; return 0;
} }
} }
#ifdef Q_WS_MAC #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; 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': case 'GURL':
{ {

View File

@@ -51,7 +51,7 @@
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#define LOGFILE TomahawkUtils::appDataDir().filePath( "tomahawk.log" ).toLocal8Bit() #define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
#define LOGFILE_SIZE 1024 * 512 #define LOGFILE_SIZE 1024 * 512
using namespace std; using namespace std;