Changed the BufferView System to a MVC Design Pattern
[quassel.git] / main / global.h
index ad4cb1d..a662fd7 100644 (file)
@@ -24,6 +24,9 @@
 /** The protocol version we use fo the communication between core and GUI */
 #define GUI_PROTOCOL 1
 
+#define BACKLOG_FORMAT 2
+#define BACKLOG_STRING "QuasselIRC Backlog File"
+
 class Global;
 
 #include <QtCore>
@@ -33,6 +36,9 @@ class Global;
 typedef QMap<QString, QVariant> VarMap;
 extern Global *global;
 
+typedef uint UserId;
+typedef uint MsgId;
+
 /**
  * This class is mostly a globally synchronized data store, meant for storing systemwide settings such
  * as identities or network lists. This class is a singleton, but not static as we'd like to use signals and
@@ -67,6 +73,7 @@ class Global : public QObject {
   public:
     enum RunMode { Monolithic, GUIOnly, CoreOnly };
     static RunMode runMode;
+    static QString quasselDir;
 
   private:
     static void initIconMap();
@@ -89,4 +96,35 @@ class Exception {
 
 };
 
+class BufferId {
+  public:
+    BufferId() { id = gid = 0; } // FIXME
+    BufferId(uint uid, QString net, QString buf, uint gid = 0);
+
+    inline uint uid() { return id; }
+    inline uint groupId() { return gid; }
+    inline QString network() { return net; }
+    QString buffer(); // nickfrommask?
+
+    void setGroupId(uint _gid) { gid = _gid; }
+
+    inline bool operator==(const BufferId &other) const { return id == other.id; }
+  private:
+    uint id;
+    uint gid;
+    QString net;
+    QString buf;
+
+    friend uint qHash(const BufferId &);
+    friend QDataStream &operator<<(QDataStream &out, const BufferId &bufferId);
+    friend QDataStream &operator>>(QDataStream &in, BufferId &bufferId);
+};
+
+QDataStream &operator<<(QDataStream &out, const BufferId &bufferId);
+QDataStream &operator>>(QDataStream &in, BufferId &bufferId);
+
+Q_DECLARE_METATYPE(BufferId);
+
+uint qHash(const BufferId &);
+
 #endif