[Tux4kids-commits] r1155 - tux4kids-admin/trunk/tux4kids-admin/src

Michał Świtakowski swistakers-guest at alioth.debian.org
Tue Jul 7 10:52:19 UTC 2009


Author: swistakers-guest
Date: 2009-07-07 10:52:18 +0000 (Tue, 07 Jul 2009)
New Revision: 1155

Added:
   tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp
   tux4kids-admin/trunk/tux4kids-admin/src/errorLog.h
Modified:
   tux4kids-admin/trunk/tux4kids-admin/src/src.pro
Log:
added errorLog class

Added: tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/src/errorLog.cpp	2009-07-07 10:52:18 UTC (rev 1155)
@@ -0,0 +1,45 @@
+#include <QDebug>
+#include <QFile>
+
+#include "errorLog.h"
+#include "applicationInfo.h"
+
+ErrorLog* ErrorLog::instance = 0;
+
+class ErrorLogCleaner
+{
+public:
+	~ErrorLogCleaner()
+	{
+		ErrorLog::Destroy();
+	}
+} SingletonCleanerInstance;
+
+ErrorLog::ErrorLog()
+{
+	logFile	= new QFile(ApplicationInfo::errorLogDir() + "/log.txt");
+}
+
+ErrorLog* ErrorLog::Instance()
+{
+	if(instance == 0)
+	{
+		instance = new ErrorLog();
+	}
+	return instance;
+}
+
+void ErrorLog::Destroy()
+{
+	if(instance != 0)
+	{
+		delete instance;
+		instance = 0;
+	}
+}
+
+void ErrorLog::log(QString message, QString userMessage)
+{
+	instance = ErrorLog::Instance();
+	qDebug() << message << " message for user: " << userMessage;
+}

Added: tux4kids-admin/trunk/tux4kids-admin/src/errorLog.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/errorLog.h	                        (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/src/errorLog.h	2009-07-07 10:52:18 UTC (rev 1155)
@@ -0,0 +1,20 @@
+#ifndef ERRORLOG_H
+#define ERRORLOG_H
+
+class QFile;
+
+class ErrorLog
+{
+public:
+	ErrorLog();
+	static ErrorLog* Instance();
+	static void Destroy();
+
+	static void log(QString message, QString userMessage = QString());
+private:
+	static ErrorLog* instance;
+
+	QFile *logFile;
+};
+
+#endif // ERRORLOG_H

Modified: tux4kids-admin/trunk/tux4kids-admin/src/src.pro
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/src.pro	2009-07-07 10:10:11 UTC (rev 1154)
+++ tux4kids-admin/trunk/tux4kids-admin/src/src.pro	2009-07-07 10:52:18 UTC (rev 1155)
@@ -6,11 +6,13 @@
     mainController.cpp \
     pluginManager.cpp \
     pluginManagerDialog.cpp \
-    applicationInfo.cpp
+    applicationInfo.cpp \
+    errorLog.cpp
 HEADERS += mainWindow.h \
     mainController.h \
     pluginManager.h \
     pluginManagerDialog.h \
-    applicationInfo.h
+    applicationInfo.h \
+    errorLog.h
 FORMS += mainWindow.ui \
     pluginManagerDialog.ui




More information about the Tux4kids-commits mailing list