[Tux4kids-commits] r1154 - tux4kids-admin/trunk/tux4kids-admin/src
Michał Świtakowski
swistakers-guest at alioth.debian.org
Tue Jul 7 10:10:13 UTC 2009
Author: swistakers-guest
Date: 2009-07-07 10:10:11 +0000 (Tue, 07 Jul 2009)
New Revision: 1154
Added:
tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.cpp
tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.h
Modified:
tux4kids-admin/trunk/tux4kids-admin/src/src.pro
Log:
addded application info class
Added: tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.cpp
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.cpp (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.cpp 2009-07-07 10:10:11 UTC (rev 1154)
@@ -0,0 +1,55 @@
+#include <QDir>
+#include <QDebug>
+
+#ifdef Q_WS_X11
+#include <sys/stat.h>
+#endif
+
+#include "applicationInfo.h"
+
+ApplicationInfo::ApplicationInfo()
+{
+}
+
+QString ApplicationInfo::name()
+{
+ return "tux4kids-admin";
+}
+
+QString ApplicationInfo::version()
+{
+ return "0.0.1";
+}
+
+QString ApplicationInfo::configurationDir()
+{
+
+#if defined(Q_WS_X11) || defined(Q_WS_MAC)
+ QString confDirName = ".tux4kids-admin";
+#elif defined Q_WS_WIN
+ QString confDirName = "tux4kids-admin";
+#endif
+
+ QDir confDir(QDir::homePath() + "/" + confDirName);
+ if(!confDir.exists()) {
+ QDir homeDir = QDir::home();
+ homeDir.mkdir(confDirName);
+#if defined(Q_WS_X11) || defined(Q_WS_MAC)
+ chmod(QFile::encodeName(confDir.path()), 0700);
+#endif
+ }
+ return confDir.absolutePath();
+
+}
+
+QString ApplicationInfo::errorLogDir()
+{
+ QString errorDirPath(configurationDir() + "/error log");
+ QDir errorDir(errorDirPath);
+
+ if(!errorDir.exists()) {
+ QDir confDir(ApplicationInfo::configurationDir());
+ confDir.mkdir("error log");
+ }
+ return errorDirPath;
+}
Added: tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.h
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.h (rev 0)
+++ tux4kids-admin/trunk/tux4kids-admin/src/applicationInfo.h 2009-07-07 10:10:11 UTC (rev 1154)
@@ -0,0 +1,19 @@
+#ifndef APPLICATIONINFO_H
+#define APPLICATIONINFO_H
+
+#include <QString>
+
+class ApplicationInfo
+{
+ public:
+ ApplicationInfo();
+
+ static QString name();
+ static QString version();
+
+ static QString configurationDir();
+ static QString errorLogDir();
+
+};
+
+#endif // APPLICATIONINFO_H
Modified: tux4kids-admin/trunk/tux4kids-admin/src/src.pro
===================================================================
--- tux4kids-admin/trunk/tux4kids-admin/src/src.pro 2009-07-07 09:35:37 UTC (rev 1153)
+++ tux4kids-admin/trunk/tux4kids-admin/src/src.pro 2009-07-07 10:10:11 UTC (rev 1154)
@@ -5,10 +5,12 @@
mainWindow.cpp \
mainController.cpp \
pluginManager.cpp \
- pluginManagerDialog.cpp
+ pluginManagerDialog.cpp \
+ applicationInfo.cpp
HEADERS += mainWindow.h \
mainController.h \
pluginManager.h \
- pluginManagerDialog.h
+ pluginManagerDialog.h \
+ applicationInfo.h
FORMS += mainWindow.ui \
pluginManagerDialog.ui
More information about the Tux4kids-commits
mailing list