X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=main%2Fquassel.h;h=3d2b54128e820e8863e13c8299b7c9a8312bb56b;hp=0c2a11b53ce3e83e811fef01ff5f71a5850db7ae;hb=31d998779868a1b572972168b2e813893d70ab90;hpb=925b072e5c7bc38949995902cf7af6e4644c2c55 diff --git a/main/quassel.h b/main/quassel.h index 0c2a11b5..3d2b5412 100644 --- a/main/quassel.h +++ b/main/quassel.h @@ -21,32 +21,60 @@ #ifndef _QUASSEL_H_ #define _QUASSEL_H_ -class Logger; -class QIcon; -class QString; +class Quassel; -#include +#include +//#include +/* Some global stuff */ +typedef QMap 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 *); + Quassel(); + //static Logger *getLogger(); + //static void setLogger(Logger *); - static QIcon *getIcon(QString symbol); +// 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; + QHash iconMap; + QMutex mutex; + QHash data; +}; + +class Exception { + public: + Exception(QString msg = "Unknown Exception") : _msg(msg) {}; + virtual inline QString msg() { return _msg; } - static QString iconPath; - static QHash iconMap; + protected: + QString _msg; };