Big refactoring completed. Everything prepared for the separation of core and gui.
[quassel.git] / main / quassel.h
similarity index 76%
rename from core/quassel.h
rename to main/quassel.h
index a054e08..b3c942b 100644 (file)
 #ifndef _QUASSEL_H_
 #define _QUASSEL_H_
 
-class Logger;
+class Quassel;
 
-#include <QHash>
-#include <QString>
+#include <QtCore>
+//#include <QMutex>
 
+/* Some global stuff */
+typedef QMap<QString, QVariant> VarMap;
+extern Quassel *quassel;
 
 /**
  * A static class containing global data.
  * This is used in both core and GUI modules. Where appropriate, accessors are thread-safe
  * to account for that fact.
  */
-class Quassel {
+class Quassel : public QObject {
   Q_OBJECT
 
   public:
-    static void init();
-    static Logger *getLogger();
-    static void setLogger(Logger *);
+    static Quassel * init();
+    //static Logger *getLogger();
+    //static void setLogger(Logger *);
 
 //    static QIcon *getIcon(QString symbol);
 
+    QVariant getData(QString key);
+
+  public slots:
+    void putData(QString key, const QVariant &data);
+
+  signals:
+    void dataChanged(QString key, const QVariant &data);
+
+  public:
+    enum RunMode { Monolithic, GUIOnly, CoreOnly };
+    static RunMode runMode;
+
   private:
     static void initIconMap();
     
-    static Logger *logger;
+    //static Logger *logger;
 
 //    static QString iconPath;
     static QHash<QString, QString> iconMap;
-
+    static QMutex mutex;
+    static QHash<QString, QVariant> data;
 };
 
 class Exception {