X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fbufferinfo.h;h=0953a10f03716346d2b58dc15262cf3650731395;hp=f0b92032f44e0497c0c4fa2eb8c3fb2b288f8557;hb=9d3446581d6f1900806b42078b7d2c16289a5fa5;hpb=23ebdc0a422294764ff3be3f8d7e56cc2b323185 diff --git a/src/common/bufferinfo.h b/src/common/bufferinfo.h index f0b92032..0953a10f 100644 --- a/src/common/bufferinfo.h +++ b/src/common/bufferinfo.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-08 by the Quassel Project * + * Copyright (C) 2005-09 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#ifndef _BUFFERINFO_H_ -#define _BUFFERINFO_H_ +#ifndef BUFFERINFO_H +#define BUFFERINFO_H #include #include "types.h" @@ -28,22 +28,44 @@ class QDataStream; class BufferInfo { public: - BufferInfo(); - BufferInfo(BufferId id, NetworkId networkid, uint gid = 0, QString buf = QString()); - - inline BufferId uid() const { return _id; } - inline NetworkId networkId() const { return _netid; } - inline uint groupId() const { return _gid; } - QString buffer() const; + enum Type { + InvalidBuffer = 0x00, + StatusBuffer = 0x01, + ChannelBuffer = 0x02, + QueryBuffer = 0x04, + GroupBuffer = 0x08 + }; - void setGroupId(uint gid) { _gid = gid; } + enum Activity { + NoActivity = 0x00, + OtherActivity = 0x01, + NewMessage = 0x02, + Highlight = 0x40 + }; + Q_DECLARE_FLAGS(ActivityLevel, Activity) + + BufferInfo(); + BufferInfo(BufferId id, NetworkId networkid, Type type, uint gid = 0, QString buf = QString()); + + static BufferInfo fakeStatusBuffer(NetworkId networkId); + + inline bool isValid() const { return _bufferId != 0; } + inline const BufferId &bufferId() const { return _bufferId; } + inline void setBufferId(BufferId id) { _bufferId = id; } + inline const NetworkId &networkId() const { return _netid; } + inline const Type &type() const { return _type; } + inline const uint &groupId() const { return _groupId; } + void setGroupId(uint gid) { _groupId = gid; } + + QString bufferName() const; - inline bool operator==(const BufferInfo &other) const { return _id == other._id; } + inline bool operator==(const BufferInfo &other) const { return _bufferId == other._bufferId; } private: - BufferId _id; + BufferId _bufferId; NetworkId _netid; - uint _gid; + Type _type; + uint _groupId; QString _bufferName; friend uint qHash(const BufferInfo &); @@ -55,7 +77,8 @@ QDataStream &operator<<(QDataStream &out, const BufferInfo &bufferInfo); QDataStream &operator>>(QDataStream &in, BufferInfo &bufferInfo); QDebug operator<<(QDebug dbg, const BufferInfo &b); -Q_DECLARE_METATYPE(BufferInfo); +Q_DECLARE_METATYPE(BufferInfo) +Q_DECLARE_OPERATORS_FOR_FLAGS(BufferInfo::ActivityLevel) uint qHash(const BufferInfo &);