StelLogger.cpp   StelLogger.cpp 
skipping to change at line 22 skipping to change at line 22
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "StelLogger.hpp" #include "StelLogger.hpp"
#include <config.h>
#include <QDateTime> #include <QDateTime>
#include <QProcess> #include <QProcess>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> #include <windows.h>
#endif #endif
// Init statics variables. // Init statics variables.
QFile StelLogger::logFile; QFile StelLogger::logFile;
QString StelLogger::log; QString StelLogger::log;
skipping to change at line 89 skipping to change at line 88
{ {
case QSysInfo::MV_10_3: case QSysInfo::MV_10_3:
writeLog("Mac OS X 10.3"); writeLog("Mac OS X 10.3");
break; break;
case QSysInfo::MV_10_4: case QSysInfo::MV_10_4:
writeLog("Mac OS X 10.4"); writeLog("Mac OS X 10.4");
break; break;
case QSysInfo::MV_10_5: case QSysInfo::MV_10_5:
writeLog("Mac OS X 10.5"); writeLog("Mac OS X 10.5");
break; break;
case QSysInfo::MV_10_6:
writeLog("Mac OS X 10.6");
break;
default: default:
writeLog("Unsupported Mac version"); writeLog("Unsupported Mac version");
break; break;
} }
#elif defined Q_OS_LINUX #elif defined Q_OS_LINUX
QFile procVersion("/proc/version"); QFile procVersion("/proc/version");
if(!procVersion.open(QIODevice::ReadOnly | QIODevice::Text)) if(!procVersion.open(QIODevice::ReadOnly | QIODevice::Text))
writeLog("Unknown Linux version"); writeLog("Unknown Linux version");
else else
skipping to change at line 130 skipping to change at line 132
// write addressing mode // write addressing mode
#ifdef __LP64__ #ifdef __LP64__
writeLog("Addressing mode: 64-bit"); writeLog("Addressing mode: 64-bit");
#else #else
writeLog("Addressing mode: 32-bit"); writeLog("Addressing mode: 32-bit");
#endif #endif
// write memory and CPU info // write memory and CPU info
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#ifndef BUILD_FOR_MAEMO
QFile infoFile("/proc/meminfo"); QFile infoFile("/proc/meminfo");
if(!infoFile.open(QIODevice::ReadOnly | QIODevice::Text)) if(!infoFile.open(QIODevice::ReadOnly | QIODevice::Text))
writeLog("Could not get memory info."); writeLog("Could not get memory info.");
else else
{ {
while(!infoFile.peek(1).isEmpty()) while(!infoFile.peek(1).isEmpty())
{ {
QString line = infoFile.readLine(); QString line = infoFile.readLine();
line.chop(1); line.chop(1);
if (line.startsWith("Mem") || line.startsWith("SwapT otal")) if (line.startsWith("Mem") || line.startsWith("SwapT otal"))
skipping to change at line 181 skipping to change at line 185
while(i < pciLines.size() && pciLines.at(i).startsWi th('\t')) while(i < pciLines.size() && pciLines.at(i).startsWi th('\t'))
{ {
if(pciLines.at(i).contains("Kernel driver in use")) if(pciLines.at(i).contains("Kernel driver in use"))
writeLog(pciLines.at(i).trimmed()); writeLog(pciLines.at(i).trimmed());
else if(pciLines.at(i).contains("Kernel modu les")) else if(pciLines.at(i).contains("Kernel modu les"))
writeLog(pciLines.at(i).trimmed()); writeLog(pciLines.at(i).trimmed());
i++; i++;
} }
} }
} }
#endif
// Aargh Windows API // Aargh Windows API
#elif defined Q_OS_WIN #elif defined Q_OS_WIN
// Hopefully doesn't throw a linker error on earlier systems. Not li ke // Hopefully doesn't throw a linker error on earlier systems. Not li ke
// I'm gonna test it or anything. // I'm gonna test it or anything.
if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000) if (QSysInfo::WindowsVersion >= QSysInfo::WV_2000)
{ {
#ifdef __LP64__ #ifdef __LP64__
MEMORYSTATUSEX statex; MEMORYSTATUSEX statex;
GlobalMemoryStatusEx(&statex); GlobalMemoryStatusEx(&statex);
skipping to change at line 254 skipping to change at line 259
writeLog("Could not get processor info."); writeLog("Could not get processor info.");
#elif defined Q_OS_MAC #elif defined Q_OS_MAC
writeLog("You look like a Mac user. How would you like to write some system info code here? That would help a lot."); writeLog("You look like a Mac user. How would you like to write some system info code here? That would help a lot.");
#endif #endif
} }
void StelLogger::deinit() void StelLogger::deinit()
{ {
qInstallMsgHandler(0);
logFile.close(); logFile.close();
} }
void StelLogger::debugLogHandler(QtMsgType type, const char* msg) void StelLogger::debugLogHandler(QtMsgType, const char* msg)
{ {
fprintf(stderr, "%s\n", msg); fprintf(stderr, "%s\n", msg);
writeLog(QString(msg)); writeLog(QString(msg));
} }
void StelLogger::writeLog(QString msg) void StelLogger::writeLog(QString msg)
{ {
msg += "\n"; msg += "\n";
logFile.write(qPrintable(msg), msg.size()); logFile.write(qPrintable(msg), msg.size());
log += msg; log += msg;
 End of changes. 6 change blocks. 
2 lines changed or deleted 8 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/