mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-04-04 16:12:24 +02:00
* Write Tomahawk.log (note capital T) to correct directory.
This commit is contained in:
parent
3cc29db086
commit
2ff3421261
@ -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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
|
23
src/main.cpp
23
src/main.cpp
@ -1,13 +1,14 @@
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#include "tomahawkapp_mac.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 );
|
||||
#include "tomahawkapp_mac.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 );
|
||||
#endif
|
||||
|
||||
#include <exception>
|
||||
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':
|
||||
{
|
||||
|
@ -51,7 +51,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#define LOGFILE TomahawkUtils::appDataDir().filePath( "tomahawk.log" ).toLocal8Bit()
|
||||
#define LOGFILE TomahawkUtils::appLogDir().filePath( "Tomahawk.log" ).toLocal8Bit()
|
||||
#define LOGFILE_SIZE 1024 * 512
|
||||
|
||||
using namespace std;
|
||||
|
Loading…
x
Reference in New Issue
Block a user