comparison src/debug.cpp @ 663:f9b805d8cab4 qt5

build with qt5 (in branch currently)
author Chris Cannam
date Thu, 14 Mar 2013 16:43:30 +0000
parents ae67ea0af696
children af295de6a59b
comparison
equal deleted inserted replaced
662:43c61fd6fea4 663:f9b805d8cab4
23 #include <QMutexLocker> 23 #include <QMutexLocker>
24 #include <QFile> 24 #include <QFile>
25 #include <QDir> 25 #include <QDir>
26 #include <QCoreApplication> 26 #include <QCoreApplication>
27 #include <QDateTime> 27 #include <QDateTime>
28 #include <QDesktopServices> 28 #include <QStandardPaths>
29 29
30 #include <cstdio> 30 #include <cstdio>
31 31
32 QDebug & 32 QDebug &
33 getEasyHgDebug() 33 getEasyHgDebug()
39 mutex.lock(); 39 mutex.lock();
40 if (!debug) { 40 if (!debug) {
41 prefix = new char[20]; 41 prefix = new char[20];
42 sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid()); 42 sprintf(prefix, "[%lu]", (unsigned long)QCoreApplication::applicationPid());
43 QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback 43 QString logFileName = QDir::homePath() + "/.easyhg.log"; // the fallback
44 QString logDir = QDesktopServices::storageLocation 44 QString logDir = QStandardPaths::writableLocation
45 (QDesktopServices::DataLocation); 45 (QStandardPaths::DataLocation);
46 if (logDir != "" && 46 if (logDir != "" &&
47 (QDir(logDir).exists() || 47 (QDir(logDir).exists() ||
48 QDir().mkpath(logDir))) { 48 QDir().mkpath(logDir))) {
49 logFileName = logDir + "/debug.log"; 49 logFileName = logDir + "/debug.log";
50 } 50 }